Hello:
I'm setting up a batch job through X++ code but I would like to create the batch job in a 'withhold' state initially. Below is a snippet of the code I'm using.
...
batInfo = rbbTask.batchInfo();
batInfo.parmCaption(sParmCaption);
batInfo.parmGroupId("");
batHeader = BatchHeader::construct();
batHeader.addUserAlerts(curUserId(),NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes,NoYes::Yes);
batHeader.addTask(rbbTask);
batHeader.save();
...
Thank you!
*This post is locked for comments
That'll work Tom! Thanks!
I believe you can do this.
After batHeader.save(), I would add something like:
select forupdate firstOnly batchJob
where batchJob.RecId == batHeader.parmBatchHeaderId();
if(batchJob)
{
batchJob.Status = BatchStatus::Hold;
batchJob.update();
}
where batchJob is an instance of the BatchJob table.
Hi Rodolfo,
Sorry for the confusion. I have setup a class that extends the RunBaseBatch class and I'm able to create a batch job. The job runs properly and completes without issue. This is a one-time job and isn't setup for reoccurrence. Users set this batch job on an as-needed basis a custom form backed by code which programmatically creates the batch job. What I was curious about was whether I can set the status of the batch job to Withhold through code as I programmatically create the batch job. Hope that clears up the confusion.
Thanks in advance.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156