- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2025 08:30 PM
- The problem I am trying to solve is to store the following code snippet like "javascript:new AcorioEmailUtils().addToRecipients(current);" to a record using flow designer.
- I can go out to the table and manually store the snippet no problem, but I need to automate it.
- Simply using a "Look Up Record" action then an "Update Record" action choosing the field and entering the code snippet is not storing the code.
- What I do not want to do is execute the code snippet at this time. This code will be executed later as the group members may change over time. I do not want to surround it with '' as I do not want to break existing functionality.
- The code is piped in from a catalog variable, I tried populating it to a flow variable instead.
- The below screen shot shows 3 different methods trying to do the same thing, the only one that writes anything is the Cc line but that has the tick marks I do not wish to include.
I am starting to go down another path to accomplish the same thing by creating a custom action and scripting the action but not sure if that buys me anything more than what I am getting using the update record function....
Inputs:
Script Step:
Suggestions would be appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2025 07:40 AM
strange, I didn't get any error but it didn't update the BCC field
It worked for me using GlideRecord update in background script, you can try to create a custom flow action and use Script Step to do that
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2025 02:00 PM
Hi Pat6,
You stated the "Update Record" action it is not storing the code. After the update occurs, what value does BCC contain? It is blank? Any flow errors generated?
You also mentioned you do not want to execute the code yet, only populate the code snippet. Assuming you got it to populate the code snippet as you expect, what will trigger the change from "storing the snippet" to "executing the snippet"? Just thinking perhaps it might make sense to focus on the point of execution and simply call AcorioEmailUtils().addToRecipients(current); to populate the BCC field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2025 06:08 AM
Thanks Craig,
The only value getting stored is from CC due to being surrounded by ''. Flow designer is trying to execute the code snippet instead of storing it for To and BCC, resulting in the below error. At the point I posted the initial question I was banging my head at trying to make it work this way, focusing on mimicking how the current process works, but before reading your response today I was pondering the same thing if I could attack the problem from a different angle like modifying the mail script, or like you suggested investigate the process that is triggering this script.
2025-05-17 01:42:22 Warning Script execution error: Script Identifier: unknown, Error Description: "AcorioEmailUtils" is not defined., Script ES Level: 0
2025-05-17 01:42:22 Error Not allowing access to script include rhino.sandbox.AcorioEmailUtils Script include is not callable from the sandbox
2025-05-17 01:42:22 Warning Evaluator: com.glide.script.RhinoEcmaError: "AcorioEmailUtils" is not defined. <refname> : Line(1) column(0) ==> 1: new AcorioEmailUtils().addToRecipients(current);
2025-05-17 01:42:22 Warning Script execution error: Script Identifier: unknown, Error Description: "AcorioEmailUtils" is not defined., Script ES Level: 0
2025-05-17 01:42:22 Error Not allowing access to script include rhino.sandbox.AcorioEmailUtils Script include is not callable from the sandbox
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2025 06:14 AM
what's your actual business requirement here?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2025 06:32 AM
A long time ago in a galaxy far away... our incident quick messages were configured so that when certain conditions are met (Short description containing "phrase", and priority is X, Y or Z, etc.) clicking on the quick message auto populates the quick message with a custom email template, auto populates the To, CC, BCC subject lines... anyways creating new messages or editing them requires the requestor to submit an enhancement request, it needs to get prioritized, depending on priorities working that request can take time. Implementation of new quick messages always takes a bit a bit because it requires several scripts to be modified and it takes the developer time to figure out how it all works together again because it is a different developer... Anyways the folks working major incidents want the ability to create new quick messages in Prod, with all the bells and whistles of auto populating the various fields.