Maybe someone can answer the question that you’re asking. But I feel like you might need to adjust your design just slightly.
(I’m going to prefix this with I’m still on my journey of learning the framework.)
I’m about to start creating all sorts of processing screens. From what I understand the PXAction will typically call a method within the graph when you anticipate that you’re going to automate this business logic via a processing screen. That method will do the things that you want to do and then return control back to the screen and update the screen with any of the changes.
When you use a processing screen, your processing code will call that method, and not press the PXAction button as a way of invoking that method. You’re disconnecting the PXAction (which is generally UI related) from the business logic.
Very crude code:
public PXAction<TheDAC> DoSomethingAction;
...
protected virtual IEnumerable doSomethingAction(PXAdapter adapter)
{
foreach (TheDAC theRecord in adapter.Get())
{
Base /*or this*/.Actions.PressSave(); /* helpful when user clicked button */
PXLongOperation.StartOperation(
Base /*or this*/,
delegate () { DoSomething(theRecord); }
);
yield return theRecord;
}
}
public void DoSomething(TheDAC theDACRecord, bool isMassProcess = false)
{
//here you do the actual logic that needs to happen when you press the button
//and you'll call this method from the processing screen
if (isMassProcess)
{
//PXProcessing.SetInfo...
}
}
//in your process graph
public PXProcessing<yourView> YourRecords;
YourRecords.SetProcessingDelegate<TheGraph>(
delegate(TheGraph graph, TheDAC theRecord)
{
try
{
graph.Clear();
graph.DoSomething(theOrder, true);
}
catch (Exception e)
{
PXProcessing<TheDAC>.SetERror(e);
}
}
);
I hope that’s helpful.