Display the Requested item variables in approval notification

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2019 12:59 PM
We have a notification which uses a 'email script' to notify approvers of a Request awaiting their approval. The problem is other than the requested item name, short description & description the notification does not tell the approver what variables where selected by the submitter.
How can I include the variables in my email script below?
==== current script =====
(function runMailScript(current, template, email, email_action, event) {
var requestItem = new GlideRecord('sc_req_item');
requestItem.addQuery('sys_id',current.sysapproval);
requestItem.query();
if(requestItem.next())
{
var subject = 'Item: '+requestItem.cat_item.name+' for '+requestItem.request.requested_for.getDisplayValue()+' is waiting for your approval';
email.setSubject(subject);
template.print('Dear '+current.approver.getDisplayValue());
template.print('<br/>');
template.print(requestItem.cat_item.name+' is waiting for your approval');
template.print('<br/>');
template.print('Requested For: '+requestItem.request.requested_for.getDisplayValue());
template.print('<br/>');
template.print('Opened by: '+requestItem.opened_by.getDisplayValue());
template.print('<br/>');
template.print('RITM: '+requestItem.number.getDisplayValue());
template.print('<br/>');
template.print('Requested Item: '+requestItem.cat_item.name);
template.print('<br/>');
template.print('Approval Manager: '+current.approver.getDisplayValue());
template.print('<br/>');
template.print('State: '+current.state);
template.print('<br/>');
//template.print('<br/>');
//template.print('Comments: '+current.comments);
}
})(current, template, email, email_action, event);
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2019 01:06 PM
You should be able to add the following where applicable.
requestItem.variables.variable_name.getDisplayValue();
Please mark this as helpful if it resolved your issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2019 01:19 PM
How is this even working.
current.sysapproval is not a field on sc_req_item table.
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2019 01:23 PM
Check this out:
https://community.servicenow.com/community?id=community_question&sys_id=cb615b2ddbdcdbc01dcaf3231f96191d
Please mark my response as correct and helpful if it helped solved your question.
-Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2019 06:31 PM