Hi all,
How we call and run a RunBaseBatch class in code ? Does it mean also the batch job will be run in background ?
If that RunBaseBatch has a DialogForm which support user input first, then are we able to give the input / parameter in that code when we call it as well ?
Any sample of how we doing this ?
Thanks,
Hi,
No problem, Sergei's code is for executing the code of RunBaseBatch class synchronously, just like any other class. My code is to run it in batch mode so user doesnt have to wait for it to finish.
Hi WWwong,
Yes, you are correct, to avoid BP warning you need to call runOperation or runOperationNow instead. If I understood correctly it's a part of SysOperationSandbox framework and depends on the result of method canRunInNewSession and kind of session (GUI or non-GUI), RunOperation method will execute run method synchronously or in async mode and show you "Waiting "progress" dialog".
Hi Sergei,
One more thing though, what's different between using .Run() and .runOperation(). Not a stopper only looking at BP warning, it suggest me using runOperation()
Thanks.
Hi Thanks,
Honestly, it looks quite "advance" for me. I'm using the one from Sergei, it is much simpler.
Anyway thanks for the help.
Code which I shared will create the batch job for execution i.e. call/run. you can play with SysRecurrenceData for setting recurrence. the variable of the actual batch job is created. you can set up all the parameters after the initialization of the class variable.
RunBaseBatch framework just implements features to run a job in batch and build on top of RunBase. You can still run it without batch.
Let's assume you have class MyClass inherited from RunBaseBatch, in this case, you can run execution in another class with the next example:
MyClass myClass = new MyClass(); // Or there can be construct method or any static method that instantate class object with parameter //Initialize some variables used for class processing myClass.parmSomething('MyValue); myClass.run();
No, it is not "how to create", it is "how to call / run" and how we give the parameters as well while we call it, because they won't be any user interaction. How to give what supposed to be asked from Dialogfield, in that code.
Just for additional, this code calling the batch is also a Batch job (created with SysOperation Framework), but my point is how we call other batch job (which is created using RunBaseBatch).
Thanks
you can use below code:
BatchHeader batchHeader; BatchInfo localBatchInfo; CustumBatch updateBatch = new CustumBatch(); SysRecurrenceData sysRecurrenceData = SysRecurrence::defaultRecurrence(); sysRecurrenceData = SysRecurrence::setRecurrenceEndAfter(sysRecurrenceData, 1); localBatchInfo = updateBatch.batchinfo(); batchHeader = batchHeader::construct(); batchHeader.addTask(updateBatch); batchHeader.parmRecurrenceData(sysRecurrenceData); batchHeader.save(); Info("Batch job created");
when you are creating the object of your runbase batch, you can set the values for parameters as needed.
You can find plenty of samples in the web.
Check these samples
https://dynamicsvn.wordpress.com/2018/10/19/how-to-create-a-simple-dialog-form-using-x-code-and-extending-runbasebatch-class/
http://www.atomicax.com/content/create-batch-executable-class
Regards,
M
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Andrés Arias as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Sohaib Cheema 789 User Group Leader
André Arnaud de Cal... 607 Super User 2025 Season 2
Martin Dráb 497 Most Valuable Professional