Hello Guys,
While working on reports we need to some times refresh the cache and usage memory in AX 2012.
Below is the job which can be written in a class and used as a menu option to clear the cache and usage data easily.
static void refreshOptions(Args _args)
{
Args args;
DialogButton button;
SysLastValue lastValue;
;
/*
* Please note after refreshing the AOD if you do not want infolog for the operation
* create an object of Args and in parmEnum method pass NoYes::Yes
*/
new MenuFunction(menuitemactionstr(SysFlushAOD), MenuItemtype::Action).run();
/*
* Please note refreshing the data if you do not the infolog for the operation
* create an object of Args and in parmEnum method pass NoYes::Yes
* In this case the infolog appears only in case of webSessions
*/
new MenuFunction(menuitemactionstr(SysFlushData), MenuItemtype::Action).run();
/*
* Please note after refreshing the dictionary if you do not the infolog for the operation
* create an object of Args and in parmEnum method pass NoYes::Yes (shown below for this option)
*/
args = new Args();
args.parmEnumType(enumnum(NoYes));
args.parmEnum(NoYes::Yes);
new MenuFunction(menuitemactionstr(SysFlushDictionary), MenuItemtype::Action).run(args);
button = Box::yesNoCancel(“@SYS62458”, DialogButton::No, “@SYS70748”);
if (button == DialogButton::Yes)
{
ttsbegin;
delete_from lastValue
where lastValue.UserId == curUserId();
ttscommit;
}
}