Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

How can I pass a catalog item variable to a mail script?

Anthony Dyer
Tera Contributor

I have created an Action in Flow designer to trigger an event which will send out a notification.  With in that notification I need to pass the date variable that the user inputs.  I have created a template and use the mail script to print this value, but it is coming back as undefined.  Here are screen shots of the Action and mail script.  Not sure what I am doing wrong and any assistance would be helpful.

 

Action:

find_real_file.png

Flow:

find_real_file.png

Mail Script:

find_real_file.png

1 ACCEPTED SOLUTION

Hi,

your event is on sc_req_item table

but in the event log the table is different

Unless the event triggers on the sc_req_item table it won't work

Can you check the inputs.template object belongs to which table

try adding this log

gs.info(inputs.template.sys_class_name); // check the table name

Regards
Ankur

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

View solution in original post

23 REPLIES 23

Thanks for the update.

If my response helped please mark it correct and close the question

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

@Anthony Dyer 

Thanks for the update.

If my response helped please mark it correct and close the question

Regards
Ankur

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

Sumit Suthar
Mega Expert

Hi Anthony Dyer

Can you to update as this if your current object is sc_req_item

var string = current.variables.<variable_name>
template.print(string);

if your current object is not sc_req_item
then please cross check you dot wolk for variables.


Regards
Sumit

I have change it to "current.variables.<variable_name>" but still got the "undefined" value.