Finally, I found the reason is the global cache.
Before mention about the solution, let me memorize the clue or the scenario which might relate to the cache problem. The possible signals of the problems are:
- The report is printed to screen (PDF format) successfully, but come up with an info windows tells us the report is printed to screen. (In normal situation, there is no such a message. In my case, object of class SalesFormLetterConfirmContract does NOT instantiated correctly, so the SSRS framework printed that report by an alternative way.)
- Object which runs on client doesn’t get the initial value or get strange value instead, once initialize.
- SalesFormLetter::mainOnServer (\Classes\SalesFormLetter line 92) return normal value
- SalesFromLetter::contruct (\Classes\SalesFormLetter line 95) return disappear value
- Some round of testing, you might get the correct value! (Data integrity issue situation)
- Strange behavior for example inconsistent data on ax session, debugger, breakpoint memorize and so on.
Solution
From google, I found these two jobs are very useful.-------------------------------------------------------------------------------
static void RefreshLocalCache(Args _args)
{
xSession::removeAOC();
SysTreeNode::refreshAll();
SysFlushDictionary::main(null);
SysFlushAOD::main(null);
SysFlushData::main(null);
SysBPCheckAIFDataObject::flushCache(true);
SysFlushReportServer::main(null);
SysFlushSystemSequence::main(null);
xSession::updateAOC();
info(“ok”);
}
-------------------------------------------------------------------------------
{
xSession::removeAOC();
SysTreeNode::refreshAll();
SysFlushDictionary::main(null);
SysFlushAOD::main(null);
SysFlushData::main(null);
SysBPCheckAIFDataObject::flushCache(true);
SysFlushReportServer::main(null);
SysFlushSystemSequence::main(null);
xSession::updateAOC();
info(“ok”);
}
Ref: https://gfeaxblog.wordpress.com/2017/12/14/ax-2012-clear-the-cache/
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
static void ResetAUC(Args _args)
{
#AiF
SysSQMSettings _Settings;
;
ttsbegin;
update_recordset _Settings setting GlobalGUID = str2Guid(#EmptyGuidString);
ttscommit;
info("Now we have to Restart the AOS Service to use a new GlobalGUID.");
}
Ref: https://ax2012anant.blogspot.de/2016/11/how-to-clear-cache-of-all-clients-in-ax.html (from the original https://thwidmer.wordpress.com/2010/05/19/reset-program-cache-file-for-all-clients/)
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
So next time, you find these kind of situation, try to check your cache also! Until the next post!