notification trigger when click on button
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2023 01:14 AM
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>');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2023 01:41 AM
approvals are for RITM and not REQ usually.
How have you configured the approval? share screenshots
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2023 01:42 AM
yes.The notification triggering on RITM(sc_req_iem) only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2023 01:51 AM
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?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader