how to create different email notifications for a catalog item

Nag9
Tera Expert

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

 

 

find_real_file.png

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

 

find_real_file.png

 

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

find_real_file.png

 

Req:4 

I want sent mail to All approvers

Email4: Approval. To: Requester. Trigger: All approver have approved the request.

find_real_file.png

 

Req:5 

I want sent a mail to requester if approval is rejected

Email5: Rejection To: Requester. Trigger: One approver has rejected the request

find_real_file.png

 

How to acheive above the requirements can any one please post some script for this

Thanks in advance.

 

 

1 ACCEPTED SOLUTION

asifnoor
Kilo Patron

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.

View solution in original post

25 REPLIES 25

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?

 

regarding #1, notification is running on  sys_approver table

 

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);

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.

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