Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Flow Designer not storing code snippet to record

Pat6
Tera Contributor
  • 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.

Pat6_0-1747451362046.png

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:

Pat6_1-1747452070707.png

Script Step:

Pat6_2-1747452211041.png

 

 

Suggestions would be appreciated.

1 ACCEPTED SOLUTION

@Pat6 

strange, I didn't get any error but it didn't update the BCC field

email client template.gif

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

AnkurBawiskar_1-1747665636427.png

 

AnkurBawiskar_0-1747665622624.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

8 REPLIES 8

@Pat6 

the inline f(x) script is thinking that it's supposed to make a call to script include but it won't find the current object

what if you store that string in system property and then simply use this

return gs.getProperty('propertyName');

property holds this value -> javascript:new AcorioEmailUtils().addCcRecipients(current);

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Pat6 

strange, I didn't get any error but it didn't update the BCC field

email client template.gif

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

AnkurBawiskar_1-1747665636427.png

 

AnkurBawiskar_0-1747665622624.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar Thank you very much for your help! That last solution works!

@Pat6 

Glad to help.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader