I know there are hundreds of posts about this. I could not find one that answers my question.
I have a working job for which I used the SysOperation framework.
The job updates table XYZSomeTable. The menu item XYZSomeJob that calls the controller is somewhere on a menu and on the XYZSomeForm.
The new requirement from consultant X is that the job should refresh datasource XYZSomeTable if the job is called from XYZSomeForm after it completes. My first thought was to reject the request. I have a vague understanding that it is not possible without massive restructuring. And then the job has the potential to become very time consuming. With contoso data it completes within a few dozen seconds, which I am quite sure will not be the case in live.
I am currently trying to achieve this. Any suggestions?
My solution A
If the job is called from the form the user should have the option to run it synchronously or asynchronously. I don't know how to do that in a user friendly way. So I reverted to run the job synchronously unconditionally if called from the form. But then the form just freezes. I want some progress dialog which I could not achieve with SysOperation in synchronous mode.
My solution B - current
I noticed there is a method parmShowProgressForm. Which I am using. It looks like this:
I'd rather have something in the direction of this:
http://devblog.sertanyaman.com/2017/03/14/synchronous-and-asyncronous-operations-in-ax7/
Is it possible to get that dialog using SysOperationServiceController? Or will I have to use SysOperationSandbox?
Nonetheless, that is working. But I am worried about the code - I have another vague idea that this code could cause issues:
static void main(Args _args) { XYZMassiveController controller = new XYZMassiveController(classStr(XYZMassiveOperation),
methodStr(XYZMassiveOperation,operation)); controller.parmArgs(_args); controller.parmShowProgressForm(_args.callerName() == formStr(XYZSomeForm)); controller.startOperation(); if (controller.parmShowProgressForm() && _args.callerName() == formStr(XYZSomeForm)) { FormRun formRun = _args.caller(); FormDataSource formDataSource = formRun.dataSource(formDataSourceStr(XYZSomeForm,XYZSomeTable)); formDataSource.research(); } }
What I noticed is if (on the front end) one waits for the progress form the form datasource will refresh, if one does not, it doesn't.
Thanks for reading