Solved

How To: mark a long run operation status to completed status

  • 26 February 2021
  • 3 replies
  • 610 views

Userlevel 4
Badge

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!

icon

Best answer by jknauf 26 February 2021, 15:31

View original

3 replies

Userlevel 3
Badge

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
Userlevel 7
Badge +10

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); 

 

Userlevel 4
Badge

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

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved