- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2023 06:43 PM
We would like to incorporate a process into the body of the email created by the notification that updates the status of the incident so that when the recipient clicks a button within the body of the email, the status of the incident is changed to "confirmed" or something similar. Any advice would be appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2023 11:28 PM - edited ‎09-06-2023 11:30 PM
Hello @shiki ,
There is one way to do this.
I'm not sure if this helps you or not but please check.
Assuming , you have written notification on incident table
Step 1 : Create Email script
here I have created custom link which will redirect to incident record.
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,/* Optional EmailOutbound */email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */event) {
var sys_id = current.getUniqueValue(); // we will get the sys_id of incident we will use in below link
template.print('<a href="' + gs.getProperty('glide.servlet.uri') + 'incident.do?sys_id=' + sys_id + '&request_type=email_link' + '&state=Resolved' + '">' + 'Update' + '</a>');
})(current, template, email, email_action, event);
Step 2 : Call this Email script in Notification body
${mail_script:Email_link}
Step 3 : Create onLoad client script on incident form
Here I have set the State to Resolved
function onLoad() {
//get URL
var gUrl = top.location.href;
/* check if link contains "email_link" string -
so only run this script if incident is updated by link */
if (gUrl.toString().includes('email_link')) {
//get the State value from link
var getState = gUrl.split('&')[2].split('=')[1];
g_form.addInfoMessage('State=' + getState);
/* update the form */
if (getState == "Resolved") {
g_form.setValue('state', 6);
g_form.setValue('close_code', 'Known error');
g_form.setValue('close_notes', 'Test');
g_form.save();
}
}
}
Output :
When I click on "Update"
It will redirect to incident form and will update the state to resolved, resolution code and notes as per onLoad script
Have a try...!!
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2023 08:26 PM - edited ‎09-06-2023 08:26 PM
You can try setting up a button/link in the notitcation. You'll want a mailto link that creates a reply and appends something like 'confirmed' to the subject line of the reply email. Then with that you create a custom inbound action to update the incident record. You can reference the docs on exambles on writing inbound actions: https://docs.servicenow.com/bundle/tokyo-servicenow-platform/page/administer/notification/reference/...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2023 08:52 PM
thank you for your reply.
I understand that the receive action by receiving a reply from the recipient updates the status of the incident.
By the way, is it still difficult to update the incident status with just one action (button click) by the recipient?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2023 08:55 PM
I don't believe there is a way to update a record directly from an email notification click. You might want to look at other notifcation other avenues for notifcations that allow updating records with a single click like a Slack/Teams notifcation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2023 11:59 PM
Thank you for your reply.
Let's consider the method.