/ Dynamics

# [X++] Warmup objects for presales (comfort solution)

I saw the post from Kurt Hatlevik on how he warms up the Dynamcis AX System for a presales demo so he can show a quick system with fast responding forms and a good performance.

He wrote this job as an idea how to do it (copied for completeness) ©Kurt Hatlevik:

static void WarmupRF(Args _args)
{
//This code is for "warming" up all RF* forms and code I have in the VAR-layer
UtilElements e;
TreeNode treeNode;
FormRun formRun;
Args args = new Args();

while select e
where e.utilLevel  == UtilEntryLevel::var    //<-- spesify layer here
&&    e.recordType == UtilElementType::Form  //<-- and only forms
&&    e.name like "RF*"                      //<-- I only want the forms that starts with the prefix RF*
{
try
{
treeNode = xUtilElements::getNodeInTree(xUtilElements::parentElement(e));
args.name(treeNode.AOTname());
formRun = ClassFactory.formRunClass(args);
formRun.init();
//formRun.run();   //<-- No need to run the form, but sometimes it can load the data
formRun.close();
}
catch
{
Infolog.clear();
continue;
}
}
}

So i liked the idea and took it further to make it more comfortable and extended. I made a simple form where one can add the Elements to be warmed up and start the process.
At the end of this post is the XPO File for download.

###### Overview

The Form has a grid with two columns for the name of the element and its type.

You can either add objects to it by creating a new record with the button or normal ways or by using the button "prefix import". I tried to find a system label that fits but without luck so name it as you need for your purposes. This function searches forms (only!) with the given prefix and add it to the list with objects to warm up.

###### Lookups

I already provided lookups for tables and forms. You can extend it as you need for other types.

1. Add case to method populateData in Class WarmUpForm. (SysExtensionFramework would be over the top here)

2. Add a List variable to the classDeclaration for caching (performance) the names.

3. Add a method for populating your data for the given type.

###### Warming Up

When your list is complete, to warm up the elements just click the button "prepare" (Vorbereiten).
As you can see in the clicked method i just implemented the functionallity for forms. You can extend it as you want for like SSRS Reports or whatever you need to be cached.