I have learnt about the feature of using multi threading using Thread class in Ax2012 then i tried to implement in following way.
You first need to implement all your logic in Static method of a class. That static method should contain Thread Class as an parameter e.g
public static void process(thread _thread)
{
FG_ConfirmationEngine confirmationEngine = new FG_ConfirmationEngine();
salesTable salesTable;
container _con;;
_con = _thread.getInputParm();
info(conPeek(_thread.getInputParm(),1));
salesTable = salesTable::find(conPeek(_thread.getInputParm(),1));
confirmationEngine.parmSalesTable(salesTable);
confirmationEngine.run();// in this method all of my confirmation pre and post logic exist
}
After creating that static method in a class you need to write the calling of that method.
Note: You cannot send any Args, Object through Thread class. You can only send parameters in a form of container through thread.setInputParm() method like _thread.setInputParm([salestable.salesid]) method.
Calling:
salesline salesline;
ExecutePermission perm;
Thread myThread;
ttsBegin;
perm = new ExecutePermission();
if (!perm)
return;
perm.assert();
while select salesid from salestable
where salestable.FG_BookingReferenceID == "BRF-0001"
{
myThread = new Thread();
myThread.setInputParm([salestable.SalesId]);
if (myThread)
{
myThread.removeOnComplete(true);
myThread.run(classnum(FG_ConfirmationEngine), staticMethodStr(FG_ConfirmationEngine,process));
}
}
CodeAccessPermission::revertAssert();
Hope it helps. Happy DAXing