Skip to main content
Answer

AutoRun Action not firing on status change

  • February 15, 2024
  • 8 replies
  • 201 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.

Best answer by bvoelsch

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

8 replies

jharris
Semi-Pro I
Forum|alt.badge.img+7
  • Semi-Pro I
  • February 16, 2024

@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


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • February 16, 2024

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


  • Author
  • Jr Varsity II
  • February 16, 2024

Here is the export of the customization project 


  • Author
  • Jr Varsity II
  • February 19, 2024

@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.


  • Author
  • Jr Varsity II
  • February 22, 2024

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


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • April 1, 2024

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


  • Author
  • Jr Varsity II
  • Answer
  • April 1, 2024

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


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • April 1, 2024

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