Oct 30, 2024 11:11 AM
I ran into a strange problem in an automation.
I am using a script to gather some data from two tables and combine it into a rich-text field. In the next step, I send out an e-mail with the content of this field. Turns out the e-mail is sent before the script has updated the text field!
Even adding a 3 second delay in the script does not solve the issue.
Curious if someone has a solution in place?
Thank you!
Solved! Go to Solution.
Oct 30, 2024 03:42 PM
The problem is not the actions running out of order. That is why adding a delay does not fix the issue.
The send email action is getting the field value from when the automation was triggered, not the value when the action is run.
There are two basic solutions. Pick whichever makes the most sense to you.
- Do a fresh read of the record after the script executes with a “find records” action. Grab the field value from the “find records” action, not the trigger.
- Have your script output the value using output.set(). Use the value outputted by the script in your email.
Oct 31, 2024 02:49 AM
Thank you, using output.set() in the script was the method I tried and makes much more sense in this context.
Thanks for your help!
Oct 30, 2024 02:55 PM
Hey @Miles!
This actually strange, and I do not see how that is possible unless your email gets triggered on a different automation (e.g. when the rich text field is not empty, or when it is updated).
However, you might want to explore including some sort of "Output.set()" on your script, and using the value obtained from such output on the body of the email -rather than the actual data from the updated field.
Please let me know if this is somehow helpful, or otherwise feel free to provide further context.
Best,
Mike, Consultant @ Automatic Nation
Oct 30, 2024 03:42 PM
The problem is not the actions running out of order. That is why adding a delay does not fix the issue.
The send email action is getting the field value from when the automation was triggered, not the value when the action is run.
There are two basic solutions. Pick whichever makes the most sense to you.
- Do a fresh read of the record after the script executes with a “find records” action. Grab the field value from the “find records” action, not the trigger.
- Have your script output the value using output.set(). Use the value outputted by the script in your email.
Oct 31, 2024 02:49 AM
Thank you, using output.set() in the script was the method I tried and makes much more sense in this context.
Thanks for your help!
Oct 31, 2024 02:50 AM