- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2018 05:24 AM
Hi,
I have created a email script, which needs to get the variables and it's values from record producer. After record producer is submitted then it will create a record on sn_hr_core_case(HR case) table.
I have created the email script for it, but I am not exactly sure how to get the values.
any can please help how can I accomplish this requirement.
Thank you.
Here is the below script I have tried, but it is NOT WORKING.
var gift = new GlideRecord('sn_hr_core_case');
gift.addQuery('sys_id', current.document_id);
gift.query();
while(gift.next())
{
template.print(item.number + ": " + item.cat_item.getDisplayValue() + "\n");
template.print(" Item Options:\n");
var keys = new Array();
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(gift.sys_id);
set.load();
var vs = set.getFlatQuestions();
for (var i=0; i < vs.size(); i++) {
if(vs.get(i).getLabel() != '') {
template.space(4);
template.print(' ' + vs.get(i).getLabel() + " = <span style='color:red'>" + vs.get(i).getDisplayValue() + "</span>\n");
}
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2018 08:06 AM
Harish,
You can try something like this and it will work
var gift = new GlideRecord('sn_hr_core_case');
gift.addQuery('sys_id', current.sys_id);
gift.query();
if(gift.next()) {
template.print(" Requestor" + m.variables.variable_name);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2018 09:04 AM
Hi Vinoth,
The above code won't work since there is an issue in script for glide record object.
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
‎08-24-2018 08:53 AM
Thank you Vinoth, it worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2020 08:00 AM
Can you share your final script? Does it work?