- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2023 09:14 AM - edited 10-11-2023 09:16 AM
Hi All,
Could you please help me with the below requirement.
- Ensure that there is a link in the email that allows the user to reopen the incident by sending an email.
- subject for inbound email = User intends to reopen the Incident.
- Ensure that there is also a link added to the email that allows the user to close complete the incident by sending an email.
- subject for inbound email to close the incident = User confirmation to close the incident.
Please assist.
Thanks & Regards.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2023 09:51 AM
Hi @Joshuu
Let's try the below approach.
1. Define an Email Template for user response. Sample below.
2. Create new Mail Script named "incident_reopen". Sample below
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
template.print('<div style="font-size: 16px;color:#181A1F;margin-top:24px;">');
template.print('<div style="padding-bottom:16px;">Hi ' + current.caller_id.first_name + ',</div>');
template.print('<div style="padding-bottom:16px;"><span style="font-weight: 600;">' + current.number + '</span> was resolved.</div>');
var days = parseInt(gs.getProperty("glide.ui.autoclose.time"));
template.print('<div>Hopefully you have everything you need. If not, you can ${mailto:mailto.reopen_incident} Otherwise, your request will be automatically closed');
var hours = days * 24;
if (days > 0) {
if (days <= 3) {
if (hours == 1)
template.print(gs.getMessage(' after 1 hour'));
else
template.print(gs.getMessage(' after {0} hours', hours));
} else
template.print(gs.getMessage(' after {0} days', days));
}
template.print('.</div></div>');
})(current, template, email, email_action, event);
3. Create new Inbound Email Action
- Name: Incident Reopen
- Table: Incident
- Action Type: Record Action
- Type: Reply
- Conditions: Subject CONTAINS User intends to reopen the Incident
- Action: (sample script below)
(function runAction( /*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
// Implement email action here
current.incident_state = 2;
current.state = 2;
current.update();
})(current, event, email, logger, classifier);
Finally, enjoy the result. The notification Incident Resolved will be sent, sample below.
Upon clicking on "Reopen this Incident", a Reply email will be opened. Once user sends the email, the Inbound Email Action should be triggered and update the Incident accordingly.
Just do the same with the Closed case. Let me know if it works for you!
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2023 09:51 AM
Hi @Joshuu
Let's try the below approach.
1. Define an Email Template for user response. Sample below.
2. Create new Mail Script named "incident_reopen". Sample below
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
template.print('<div style="font-size: 16px;color:#181A1F;margin-top:24px;">');
template.print('<div style="padding-bottom:16px;">Hi ' + current.caller_id.first_name + ',</div>');
template.print('<div style="padding-bottom:16px;"><span style="font-weight: 600;">' + current.number + '</span> was resolved.</div>');
var days = parseInt(gs.getProperty("glide.ui.autoclose.time"));
template.print('<div>Hopefully you have everything you need. If not, you can ${mailto:mailto.reopen_incident} Otherwise, your request will be automatically closed');
var hours = days * 24;
if (days > 0) {
if (days <= 3) {
if (hours == 1)
template.print(gs.getMessage(' after 1 hour'));
else
template.print(gs.getMessage(' after {0} hours', hours));
} else
template.print(gs.getMessage(' after {0} days', days));
}
template.print('.</div></div>');
})(current, template, email, email_action, event);
3. Create new Inbound Email Action
- Name: Incident Reopen
- Table: Incident
- Action Type: Record Action
- Type: Reply
- Conditions: Subject CONTAINS User intends to reopen the Incident
- Action: (sample script below)
(function runAction( /*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
// Implement email action here
current.incident_state = 2;
current.state = 2;
current.update();
})(current, event, email, logger, classifier);
Finally, enjoy the result. The notification Incident Resolved will be sent, sample below.
Upon clicking on "Reopen this Incident", a Reply email will be opened. Once user sends the email, the Inbound Email Action should be triggered and update the Incident accordingly.
Just do the same with the Closed case. Let me know if it works for you!
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2023 09:59 AM
Hi @Tai Vu,
Thanks for the response. It is working as expected.
And is there a way that we can take a report in ServiceNow like the count of the incidents which user responded through email for resolving or closing the incidents by clicking on these links? If yes, how can we achieve that?
Could you please assist.
Thanks & Regards.