How to get Variable detail in Notification Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2019 10:06 AM
Hi,
I have a Notification Script designed now i want to get the variable details in Notificaiton script can anyone please help me on this

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2019 10:15 AM
Hi there,
In the Message HTML of Notifications, you could use something like below to display the value of a variable:
${variables.your_actual_variable_name}
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2021 08:06 AM
Thank you very much!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2019 10:16 AM
Hi Irfan,
Try using below snippet in your mail script & then call the mail script in mail body of notification.
Mail Script: getVariables.
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
template.print("<b>Summary of Requested items:\n</b>");
var item = new GlideRecord("sc_req_item");
if (item.get(current.request_item.sys_id))
{
template.print(item.number + ": " + item.cat_item.getDisplayValue() + "\n");
var keys = new Array();
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(item.sys_id);
set.load();
var vs = set.getFlatQuestions();
for (var i=0; i < vs.size(); i++)
{
if(vs.get(i).getDisplayValue() != '')
{
template.space(4); template.print(' ' + vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "\n");
}
}
}
})(current, template, email, email_action, event);
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2021 06:35 AM
Hi,
I have the similar requirement but this code is not working for me. could please help