Hello! I'm having trouble understanding how the "...
# suiteflow
m
Hello! I'm having trouble understanding how the "set field value" action and the "After Record submit" actually work. 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'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.
n
I think that it is not possible for a user event script to trigger another user event script.
You could replicate the second function that you want into the same workflow
m
Hello! Sorry for my late answer. I know that User Events cannot trigger other User Events. But in this case we are considering a Workflow action that fires a User Event and that is allowed. Rather, it seems a bug of "Set Field" action or at least a behaviour that is different from what is described in official documentation. After my last post, I've conducted further tests and the result is that, if I replace the "Set Field" value with a custom workflow action that simply set the field and save, the User Event is correctly triggered. I think I'll open a ticket to Netsuite about the "Set Field" behavior. I'll keep you updated on their response.
✔️ 2