Solved

Just to clarify my last question, I am trying to run an Action on Form using a Schedule? how to do this?

  • 6 December 2022
  • 3 replies
  • 85 views

Userlevel 3
Badge

I was told that it can be done though a process Form.  

I have tried to do that in my last question and it is not working.  Can I schedule an Action on a Form, or a little clearer how do call that action from the process button on a process form? If I can do the last then I know I can schedule the process button action. 

icon

Best answer by Django 6 December 2022, 17:22

View original

3 replies

Userlevel 6
Badge +4

Hi @edwardmcgovern97 

 

You have to create a processing form. Please refer to:

Creation of Processing Forms

Userlevel 7
Badge +5

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.

Userlevel 3
Badge

Hey Leonardo, thanks for the reply.  I did already create the Process Form. 

ddun, I posted the same answer under my second post but you beat me by about 10 minutes.  Thanks.  I am fairly new too but appreciate the response. 

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