Skip to main content
Solved

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

  • February 26, 2021
  • 3 replies
  • 737 views

vivekm
Varsity I
Forum|alt.badge.img

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!

Best answer by jknauf

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
View original
Did this topic help you find an answer to your question?

3 replies

Forum|alt.badge.img
  • Varsity II
  • 35 replies
  • Answer
  • February 26, 2021

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

Gabriel Michaud
Captain II
Forum|alt.badge.img+11

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

 


vivekm
Varsity I
Forum|alt.badge.img
  • Author
  • Varsity I
  • 78 replies
  • February 26, 2021

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings