Skip to main content

I have code that I want to run after a long running operation completes, if a method in the long running operation returns ‘true’, to show a simple error message popup.

PXLongOperation.WaitCompletion(key);

PXLongOperation.WaitCompletion(key); seems to be what I need, but I can’t figure out what to use for the key. When I use ‘this’ as shown in the screenshow, it doesn’t find the long running operation and proceeds to skip over the error message code since the variable value will be null.

What am I doing wrong here?

It will be:

PXLongOperation.WaitCompletion(this.UID);

 

 


@Django  That’s what I thought too, but apparently not, or I’m also doing something else wrong.
 

 


It will be the graph that you’re waiting for. If that graph is an extension of another graph because you’ve added functionality then you’ll want to use:

Base.UID


@Django  Is that the case even though I used the “this” keyword to pass the graph extension as the key when I started the long operation?

 


Sorry - should probably be:

this.Base.UID

I’m basing that off of the error message which is saying that a graph extension doesn’t have a method called UID. But this.Base will have that (unless Base is also a graph extension in which case this.Base.Base.UID (I think))

When I searched the source code for PXLongOperation.WaitCompletion I see references to code that uses a key variable. But in those cases, the code has created a GUID for value of the key variable and then passed that variable to a PXLongOperation.StartOperation(key… call followed by PXLongOperation.WaitCompletion(key);

 

 


It will be the graph that you’re waiting for. If that graph is an extension of another graph because you’ve added functionality then you’ll want to use:

Base.UID

This works.
using: this.Base.UID is apparently unnecessary.

Thanks for your help!


Reply