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  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

23 REPLIES 23

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Can you try to update as this if the current object is sc_req_item

var string = current.variables.maintenance_date.toString();

Regards
Ankur

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

I have made the change but it is still coming back as "undefined"

Hi,

the email notification and event is on which table?

Regards
Ankur

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

Event:

find_real_file.png

 

 

Notification: Should this be pointing to the Requested Item Table as well?

find_real_file.png