Solved

AutoRun Action not firing on status change

  • 16 February 2024
  • 8 replies
  • 90 views

in 2023r1 i created a customization that is supposed to print a custom report when an order’s status changes to open.  I have a PXAutoAction setup in the code and it is displaying correctly.  I added the action to a new workflow that extends the SO Workflow.  In the open state I added the new action with the Auto run allow set to true and the auto-run condition set to True.

The action does not seem to be running.  I added some information trace statements to see if they would show up in the trace, they did not.

Any advice or steps that you can provide will be appreciated.

icon

Best answer by bvoelsch 2 April 2024, 01:27

View original

8 replies

Userlevel 6
Badge +6

@bvoelsch 

Here’s some items to consider while you troubleshoot based on the information you've shared:

  1. Correct Definition: Ensure the action meant to print the custom report is defined as a PXAutoAction if you expect it to be auto-run. If it's defined as a PXAction, it will not support the auto-run feature directly.

  2. Action Addition and Update: You must first add the action to the workflow and then update it to be an auto-run action. This involves adding the action under the appropriate state and then updating it with IsAutoAction() .

  3. Graph Extension: Verify that the graph extension is correctly associated with the SOOrder entry graph that contains the workflow being modified.

  4. State Identifier: Make sure you are updating the correct state. In your case, if you're looking to trigger the report when the order status changes to 'Open', you need to ensure you're targeting the correct state that represents the 'Open' status in the SO Extended Workflow.

  5. Condition Logic: If your auto-run condition is set to always true (IsAutoAction(conditions.TrueCondition)), the action should run every time the state is entered. If there is a specific condition (IsAutoAction(conditions.MyCondition)), double-check that this condition is properly evaluated to true when expected.

  6. No Conflicts: Check for any other workflow customizations or extensions that might be affecting the same workflow state or action.

  7. Exception Handling: Ensure that the code within your custom action is robust and handles any exceptions so they don't prevent the action from completing.

  8. Debugging with Trace: Use trace statements effectively to debug the issue. Make sure these statements are placed in a way that they will execute, to confirm whether the action is being triggered or not.

Here’s a nice workflow blog that discusses this scenario with some examples on Auto-Run Actions:
https://www.acumatica.dev/brian/workflow-via-code-part-5/

Hope this helps!

-James

Userlevel 7
Badge +17

@bvoelsch  Possible to share the customization to investigate from our end?

Here is the export of the customization project 

@jamesh I have run through the steps you outlined.  Can you explain steps 2 and 5 more, I believe the both relate to the workflow blog that you added.  I am am still really early on in learning how to create customizations in acumatica.

@Naveen Boga Did you get a chance to look at the customization to see if where we should make updates

Userlevel 7
Badge

Hi @bvoelsch were you able to find a solution? Thank you!

I had to change the way we solved this issue.  We overrode the persist method for SOOrderEntry with some additional filtering.  All of the auto action code were removed.  Also, there was no need for any workflow customizations

Userlevel 7
Badge

Thank you for sharing your solution with the community @bvoelsch!

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