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

Hi,

that's correct.

Did you see the event got triggered in event logs with the correct RITM record

Also are you sending the correct RITM record in 4.3->Template as the input to the action

Regards
Ankur

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

I was able to confirm that I am sending the correct RITM record in 4.3,  It was unclear in the event log for which RITM is being used at the time the event was triggered.  I have also set the Table on the Notification to the sc_req_item table but still got "undefined" when send the notification.

Hi,

Can you check by printing the RITM number

template.print(current.number);

Regards
Ankur

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

Hi,

Also are you sure the catalog item to which this RITM belongs has that variable?

Regards
Ankur

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

That is coming back as undefined as well.  The item as the variable through a variable set.