Code below can be used to clear caches for Dynamics 365 for Operations as well as AX 2012.
In AX 2012, copy and past code below into Job to execute and clear cache.
In D365 create runnable class as below, set that class as startup object for the project, set that project as startup project for the solution and execute class.
class RunnableClassTest
{
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public static void main(Args _args)
{
xSession::removeAOC();
SysTreeNode::refreshAll();
SysFlushDictionary::main(null);
SysFlushAOD::main(null);
SysFlushData::main(null);
//SysBPCheckAIFDataObject::flushCache(true); // only for AX 2012
SysFlushReportServer::main(null);
SysFlushSystemSequence::main(null);
xSession::updateAOC();
info("Executed.");
}
}
In AX 2012, copy and past code below into Job to execute and clear cache.
In D365 create runnable class as below, set that class as startup object for the project, set that project as startup project for the solution and execute class.
class RunnableClassTest
{
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public static void main(Args _args)
{
xSession::removeAOC();
SysTreeNode::refreshAll();
SysFlushDictionary::main(null);
SysFlushAOD::main(null);
SysFlushData::main(null);
//SysBPCheckAIFDataObject::flushCache(true); // only for AX 2012
SysFlushReportServer::main(null);
SysFlushSystemSequence::main(null);
xSession::updateAOC();
info("Executed.");
}
}
No comments:
Post a Comment