Business requirement
Some flow should execute some code in batch, so you need to add a batch job for the corresponding RunBaseBatch class.
Solution
public static void scheduleBatch()
{
BatchHeader batchHeader;
BatchInfo localBatchInfo;
YourRunBaseBatchClass yourRunBaseBatchClass;
SysRecurrenceData sysRecurrenceData =
SysRecurrence::defaultRecurrence();
;
yourRunBaseBatchClass =
YourRunBaseBatchClass::construct();
// retry 3 times
sysRecurrenceData =
SysRecurrence::setRecurrenceEndAfter(
sysRecurrenceData, 3);
// retry after 1 minute
sysRecurrenceData =
SysRecurrence::setRecurrenceUnit(sysRecurrenceData,
SysRecurrenceUnit::Minute, 1);
localBatchInfo = yourRunBaseBatchClass.batchinfo();
localBatchInfo.parmGroupId("YourBatchGroupId");
batchHeader = batchHeader::construct();
batchHeader.addTask(yourRunBaseBatchClass);
batchHeader.parmRecurrenceData(sysRecurrenceData);
batchHeader.save();
}
Thank you for sharing this with us. This article really helped me.
Hi Patrik
Thanks for sharing!
I have a question for you.
I want to calculate a configured item when sales order created, then configure the line, i put the cost calculation in a batch job, and without any user interface. I tried your job, and it seems that the calculation has not been done. i use the class BOMCalcJob_Item to do the calculation. can you show me how to run this by x++?
Thanks in advance!
Rosa
I am not sure where you're getting your info, but good topic.
I needs to slend some time learning much more or
understanding more. Thanks for fantastic info
I was looking for this information for my mission.
Here is a detailed tutorial on how to add support for batch processing to an existing form in Dynamics 365 for Finance and Operations:
https://ax.docentric.com/make-form-batchable-dynamics-365-finance-operations/
Post a Comment