Sorry for the cross posting but the case is halfway among Suiteflow and Suitescript and maybe here there's somebody that could help.
I'm having trouble understanding how the "set field value" action and the "After Record submit" actually work in Workflows related to User Event Scripts.
I have this situation:
• there is a User Event Script from Italian Accounting Bundle that, if a checkbox is flagged, calculates a new document number
• I wrote a 3-way matching Workflow on Purchase Order and Vendor Bill. To perform its checks, it needs to act on a "After Record Submit" trigger because it needs to compare lines based on a Saved Search. When the condition is met, it sets two fields: one of them is the checkbox mentioned earlier.
• According to the Netsuite documentation, Workflow Actions in "After Record Submit" are executed after the User Event scripts in "After Submit".
Since the Netsuite documentation also states that a "Set Field Value" action, when placed in a After Record Submit, causes the record to be saved again when the workflow completes, I expected the following sequence of events:
1. the User Event is triggered a first time in "after submit" but, since the checkbox is not flagged, it doesn't perform any actions.
2. the Worklow runs after the User Event, performs its checks, and sets the checkbox using the "Set Field Value" action
3. The User Event, triggered by the save operation caused by "Set Field Value", acts a second time and populates the new document number.
What I obtain instead:
• the checkbox is flagged
• the document number is empty
It seems that, depsite the documentation, the "Set Field Value" in workflows behaves like record.submitFields method in Suitescript and it does not trigger any User Event.
It's worth noting that the same action is perfomed on the same workflow on a button press, and there it works like a charm.
Could anybody help me understand what is happening and how to solve this issue?
Thanks in advance.