- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2019 02:21 AM
Hi All, I have below requirement for creating different email notifications to a catalog item "ABC"
Req:1
I want sent a email notification like below template to the requester
Email1: Email upon submittal. To: Requester, Trigger: Submittal of completed (all mandatory fields populated) property removal form
Req 2: I want sent mail to the infrastructure owner(Variable in catalog item)
Email2: Please approve or reject. To: Infrastructure Owner, Trigger: Submittal of completed (all mandatory fields populated) property removal form
Req:3
i want sent mail to the approvers in Ritm form
Email: Please approve or reject. To: Next approver in the workflow , Trigger: Approval by the previous approver
Req:4
I want sent mail to All approvers
Email4: Approval. To: Requester. Trigger: All approver have approved the request.
Req:5
I want sent a mail to requester if approval is rejected
Email5: Rejection To: Requester. Trigger: One approver has rejected the request
How to acheive above the requirements can any one please post some script for this
Thanks in advance.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2019 02:27 AM
Go to Notifications and start configuring for each of those points.
Let me know if you have any questions.
Mark the comment as helpful if it helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2019 06:11 AM
No it is not correct syntax.
Also, you need to query sc_req_item for the submitted variables data.
Try like this
var gr = new GlideRecord("sc_req_item");
gr.addQuery("sys_id","e203db0ddbd83f00d9149ca4db961914"); //Replace your RITM sys_id.
gr.query();
while(gr.next()) {
template.print("Device Recipient Name:" + gr.variables.Recepient_name_reference() + '<br/> <br/>');
}
And regarding #1, on which table did you have the notification?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2019 06:19 AM
regarding #1, notification is running on sys_approver table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2019 06:37 AM
Yes tried, its not getting any value.
see the below code
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id', current.sys_id);
gr..query();
while(gr.next()) {
{
template.print("Property removal identifier (RITM):" + gr.variables.number() + '<br/> <br/>');
//template.print("Requestor:" + current.variables.opened_by.getDisplayValue() + '<br/> <br/>');
template.print("Device Recipient Name:" + gr.varaiables.Recepient_name_reference() + '<br/> <br/>');
//template.print("Can device be destroyed?:" + current.variables.device_destroyed.getDisplayValue() + '<br/> <br/>');
//template.print("Site:" + current.variables.Site.getDisplayValue() + '<br/> <br/>');
})(current, template, email, email_action, event);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2019 06:41 AM
If you are running this code on sysapproval_approver table, then we don't need sys_id of current object.
We need sys_id of RITM.
so change this line in the above code
gr.addQuery('sys_id', current.sys_id);
WITH
gr.addQuery('sys_id', current.sysapproval);
Kindly mark my comment(s) as helpful if it works.
Also, as given in the code, you shoudl not use CURRENT in template.print. Use gr in place of current while printin the variables.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2019 06:50 AM
Still value is not getting
template.print("Property removal identifier (RITM):" + gr.variables.number() + '<br/> <br/>');
"Property removal identifier (RITM):" Upto here it is printing, value is not getting