notification trigger when click on button

Shaik22
Tera Expert

Hello,

 

when request is submitted from portal one notification is trigger to manager in that one approve button is there for that approve button i wrote email script.when manager clicks on approve button again one notification need to trigger.for this i created event and called that event in email script.The issue here is 2 notifications are triggering when request is submitted.where i did mistake in email script.help me.

email script for approve:

approveButton();

function approveButton() {

var instance = gs.getProperty("instance_name");
var link = "https://" + instance + ".service-now.com";
var mark = email.watermark;
var number = current.number;
var emailAddress = instance + "@service-now.com";
var response = "approve";
var accept = "I approved this request";
var emailbod = 'approve';
if (current.getTableName().indexOf("sysapproval") != -1) {
number = current.sysapproval.number;
}
gs.eventQueue("user.approve.request", current, gs.getUserID(), gs.getUserName());


template.print('<a style="background-color:green; color:white; text-decoration:none; float:right; margin-right:1%; border: 1px solid black; padding:6px; border-radius: 4px;" href="mailto:' + emailAddress + '?subject=Re:' + ' ' + number + ' ' + response + '&body=' + emailbod + mark + '">Approve</a>');

}

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@Shaik22 

approvals are for RITM and not REQ usually.

How have you configured the approval? share screenshots

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

yes.The notification triggering on RITM(sc_req_iem) only.

@Shaik22 

so you are saying once the manager approves then you want to send another email?

why to have that logic in email script?

why not add it to the workflow or flow where you already have the logic to send approval email?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader