Monday 20 October 2008

RunBase - classes and Best Practice

There are certain classes which serve as excellent templates. One such class the LedgerExchAdj-class. If only all runbase-classes were as this one. In my opinion its simplicity and readability is top-notch. I've edited the class-specific code so that only the run() template is present, which included that all important error handling, which one might forget



public void run()
{
#OCCRetryCount
;

try
{
ttsbegin;
// Insert code here
ttscommit;
}

catch (Exception::Deadlock)
{
retry;
}

catch (Exception::UpdateConflict)
{
if (appl.ttsLevel() == 0)
{
if (xSession::currentRetryCount() >= #RetryNum)
{
throw Exception::UpdateConflictNotRecovered;
}
else
{
retry;
}
}
else
{
throw Exception::UpdateConflict;
}
}
}

Friday 3 October 2008

Setting Cross-reference update in a Schedueld task

An updated Cross reference is an indispensable tool when developing for AX but the client-side dependency can be annoying. So after a little research I found the command line parameter/Windows build-in Scheduled task combo and it does the trick.

In the class SysStartupCmd's construct the command line parameter compileAll-startup command the the parm _+ instantiates a complete compile and cross reference update which means that if you set-up a Scheduled task in Window's standart scheduled task tool with the parameter -startupcmd=compileAll_+ you can update when it suits your development team best.