- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2020 02:13 AM
Hello Team,
I need help how to show variables which added on catalog form through email notification. As shown below all that variables has to show on email notification. I have tried by creating Script Include.
Thanks,
JRY
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2020 03:04 AM
Hi,
I have updated code as below and it worked for me
can you update these 2 lines
var value = current.variables.software_selection.toString(); // give proper variable name here
var parser = JSON.parse(value);
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2020 03:04 AM
Hi Mark,
I have tried what Ankur Asked me to do which he shared script. You can find all the images of the script and variables.
Thanks,
JRY

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2020 02:21 AM
Hi,
Please try this
current.sysapproval.ref_sc_req_item.variables.<variable_name>
By using "ref_sc_req_item", you are typecasting sysapproval reference which is of type task. Using this syntax you can get not just the variables, but any other fields that are specific to the record that is type casted.
Mark correct or helpful if this helps.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2020 02:30 AM
Hi,
the variable looks to be multi row variable set; you can use email script in the notification as below
MRVS holds JSON value. You need to parse the JSON value
Email Script:
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
var value = current.variables.<software_selection>; // give proper variable name here
var parser = JSON.parse(JSON.stringify(value));
for(var i=0;i<parser.length;i++){
template.print('Software name is: ' + parser[i].software); // give proper variable name here
template.print('Option is: ' + parser[i].add_remove); // give proper variable name here
}
})(current, template, email, email_action, event);
Calling mail script in notification:
${mail_script:show_variables}
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2020 02:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2020 02:45 AM
Hi,
the above notification is on sc_req_item table?
if yes then this should work
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader