Inbound Action: create new INC if replying to closed INC
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 05:04 AM
Rather than the baseline Inbound Action "Update Incident (BP)" which reopens a Closed Incidents if its replied to with the subject line "please reopen," we'd like any reply to closed incident to result in opening a new incident.
I thought I had the inbound action script sorted out, but trying to test in our DEV instance, however, it doesn't seem to be working for me and I was wondering if anyone could help figure it out?
I inactivated Update Incident (BP), reopening close incidents isn't functionality we want, and I made a new Inbound Action using this script:
(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
// Implement email action here
gs.include('validators');
if (current.getTableName() == "incident") {
var gr =current;
if (gr.state ==IncidentState.CLOSED) {
var sg = new GlideRecord('table_name');
sg.newrecord();
sg.setValue('short_description',email.subject.toString());
sg.setValue('description',email.body.toString());
// set remaining values
sg.setValue('field_name','set_the value');
sg.insert();
} else {
gr.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
if (gs.hasRole("itil")) {
if (email.body.assign != undefined)
gr.assigned_to = email.body.assign;
if (email.body.priority != undefined && isNumeric(email.body.priority))
gr.priority = email.body.priority;
}
gr.update();
}
}
})(current, event, email, logger, classifier);
But, when I reply to a closed ticket email to test, my Received Mailbox is recording the emails with the following message: "did not create or update incident using current" and no new Incident is opened... are you able to see what I'm doing wrong?
Thanks!
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 07:44 AM
mind pasting code here ?
and a screenshot of how your recreation inbound action is configured
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-18-2022 08:45 AM
Sure thing, the inbound action settings are:
And the script itself is:
(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
// Implement email action here
gs.include('validators');
if (current.getTableName() == "incident") {
var gr =current;
if (gr.state ==IncidentState.CLOSED) {
var sg = new GlideRecord('table_name');
sg.newrecord();
sg.setValue('short_description',email.subject.toString());
sg.setValue('description',email.body.toString());
// set remaining values
sg.setValue('field_name','set_the value');
sg.insert();
} else {
gr.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
if (gs.hasRole("itil")) {
if (email.body.assign != undefined)
gr.assigned_to = email.body.assign;
if (email.body.priority != undefined && isNumeric(email.body.priority))
gr.priority = email.body.priority;
}
gr.update();
}
}
})(current, event, email, logger, classifier);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2022 04:27 AM
Am I allowed to bump a thread? Still coming up mystified as to why this isn't working, or at least giving a more detailed error message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2025 06:46 AM
Hi we have a similar requirement and stuck at the same process where the inbound says "did not create or update incident using current". Have you been able to find a solution for it. If yes, would mind share it.
Thanks for the help