Question Status

Suggested Answer
Alex Kaganov asked a question on 12 Feb 2015 3:52 AM

Maybe a stupid question but is it possible to marshall the execution flow back to the client code from the server code?

The issue I'm facing has to do with SysOperationFramework. I've got a service which collects the parameters based on the contract, then executes the run method and in the end of that execution opens up a form. It all works in test mode on the client but when I try running it properly, I'm getting an error.

Stack trace: Invalid attempt to call ClassFactory.formRunClassOnClient running in CIL on the client.

I also created a small test class with a single method set to run on client and tried calling that method with the same result.

I get the idea of the issue but is there any way to overcome? If not, what's the best approach? I guess I could just create a dialog box not derived from SysOperationFramework and have it collect the parameters.

Reply
Suggested Answer
Nigel Deacon responded on 13 Feb 2015 3:05 AM

The answer to this is no. The server instance does not have access to the client instance, so cannot open a form on the client. You would need to have the server method return the information to the caller, which would need to be client based, which would then be able to open a form.

Reply
Alex Kaganov responded on 13 Feb 2015 3:26 AM

In my case it's certainly too complicated and not worth the trouble but what is the general approach since it's SysOperationFramework implementation? I guess I could overwrite SysOperationServiceController.afterOperation or subscribe to async callback?

I looked at a couple of scenarios in standard AX that accomplish something similar to what I need from the UI point of view.

One - sales order confirmation - is based on SysOperationFramework and they overwrite dialog method to bring up a custom form instead.

The other one - payment proposal - does it more in the fashion I was looking for, first a dialog comes up and then they bring up a custom form but turns out SysOperationFramework is not implemented there. Instead they use RunBase so everything runs on the client.

This made me think about one more question - SysOperationFramework is a replacement for RunBaseBatch in 2012 but do we have a replacement for RunBase?

Reply
Suggested Answer
Nigel Deacon responded on 13 Feb 2015 3:05 AM

The answer to this is no. The server instance does not have access to the client instance, so cannot open a form on the client. You would need to have the server method return the information to the caller, which would need to be client based, which would then be able to open a form.

Reply