- 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 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 02:50 AM
yes asif
Created first notification and created email script for that see below screen shot , first notification is working correctly, but if raised again new ritm for second notification this also triggering
Below is the email script
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
{
template.print("Device Recipient Name:" + current.variables.Recepient_name_reference.getDisplayValue() + '<br/> <br/>');
template.print("Can device be destroyed?:" + current.variables.device_destroyed.getDisplayValue() + '<br/> <br/>');
template.print("Site:" + current.variables.Site.getDisplayValue() + '<br/> <br/>');
template.print("Quantity:" + current.variables.u_quantity1.getDisplayValue() + '<br/> <br/>');
template.print("Device Type:" + current.variables.device_type.getDisplayValue() + '<br/> <br/>');
template.print("Equipment_location:" + current.variables.equipment_location1.getDisplayValue() + '<br/> <br/>');
template.print("Equipment_location:" + current.variables.equipment_location2.getDisplayValue() + '<br/> <br/>');
template.print("Description of Item:" + current.variables.Item_description1.getDisplayValue() + '<br/> <br/>');
template.print("Description of Item:" + current.variables.Item_description2.getDisplayValue() + '<br/> <br/>');
template.print("Device Name:" + current.variables.device_name1.getDisplayValue() + '<br/> <br/>');
template.print("Device Name:" + current.variables.device_name2.getDisplayValue() + '<br/> <br/>');
template.print("Serial Number:" + current.variables.serial_number1.getDisplayValue() + '<br/> <br/>');
template.print("Serial Number:" + current.variables.serial_number2.getDisplayValue() + '<br/> <br/>');
template.print("ServiceNow Change Ticket:" + current.variables.change_ticket.getDisplayValue() + '<br/> <br/>');
template.print("Manager Responsible for Infrastructure:" + current.variables.responsible_manager.getDisplayValue() +'<br/> <br/>');
template.print("Describe Request:" + current.variables.describe_request.getDisplayValue() + '<br/> <br/>');
template.print("Has the equipment configuration been cleared or reset:"+ current.variables.equipment_configuration1.getDisplayValue() + '<br/> <br/>');
template.print("Has the equipment configuration been cleared or reset:"+ current.variables.equipment_configuration2.getDisplayValue() + '<br/> <br/>');
}
})(current, template, email, email_action, event);
2. here is the second notification
below are the email scripts
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
{
template.print("Property removal identifier (RITM):" + current.variables.number.getDisplayValue() + '<br/> <br/>');
template.print("Requestor:" + current.variables.opened_by.getDisplayValue() + '<br/> <br/>');
template.print("Requested date:" + current.variables.opened_at.getDisplayValue() + '<br/> <br/>');
}
})(current, template, email, email_action, event);
Second notification is triggering upon approval of the first approval, but its not getting any body in email and first notification also triggering

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2019 02:57 AM
1. When do you want the notification o trigger?
As per your 1st screenshot, you have configured to trigger on the insert as well as update. hence it might be triggering email on every update as well.
2. For 2nd notificaton, check under What it contains, are you calling the mail script correctly or not.
Also, current.variables will work only for RITM. since your 2nd notification is on sysapprover table, current cannot fetches the variables of RITM.
you need to write query Gliderecord to fetch the details in the mail script.
Mark the comment as a correct answer and also helpful once worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2019 03:02 AM
for the first notification can we use event fire option so that, it might be trigger one time only?
If yes how can we do that one. this notification should be trigger when a ritm is raised
I will try the second notification by using glide record