Skip to main content

Hello Everyone,

I have a custom button action with a long run to execute some business logic. Now, have a requirement where have to perform some updates based on the latest modifications performed by this long run.

Is there a way we can set the long run operation status to completed, so that the record gets updated in DB and I can fetch those modified records and perform my updates in the same button click.

Thanks in advance!

Hey there vivekm,

So long operations are automatically set to the status of completed once the long process completes in it’s separate thread. You can read about that here: https://help-2020r2.acumatica.com/Wiki/ShowWiki.aspx?pageid=3e8c46fa-54a8-4f9c-9353-aa559c346215

If you want more code to execute once this has completed, try using: 

PXLongOperation.WaitCompletion(this.UID);

// your code to execute after the operation has completed goes here

Dear @vivekm,

If I recall correctly, caches are cleared and the record is reloaded after a long-operation completes.

Is there any reason why you can’t perform the modifications and updates based in the long-run it self? Is it a separation-of-concerns issue?

If you want to run code after the long operation completes, you can create a class that implements IPXCustomInfo which contains a single function:

void Complete(PXLongRunStatus status, PXGraph graph). 

In the first long of your long operation, call:

PXLongOperation.SetCustomInfo(anInstanceOfYourIPXCustomInfoImplementation); 

 


Thank you for the input @jknauf @Gabriel Michaud. I will try the suggested approaches.


Reply