- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2024 08:04 AM
I am trying to reopen an incident from email but the inbound always results in error: Service Desk - Reopen incident : did not create or update incident using current
Here is the script:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2024 10:58 AM
Hi @ElC, I think you are missing the update function call in your script.
current.update();
Thank you,
Swapnil Deo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2024 03:55 PM - edited 07-09-2024 03:56 PM
Hi @ElC ,
The only issue I can see is that you are not updating the data anywhere, please find the updated script-
(function runAction(current, event, email, logger, classifier) {
if (current.getTableName() == "incident") {
gs.info('Processing inbound action for incident record: ' + current.number);
if (current.state == 6) {
gs.info('Incident ' + current.number + ' is in resolved state.');
var subject = email.subject.toLowerCase();
if (subject.indexOf("reopen") >= 0 || subject.indexOf("wieder geöffnet") >= 0) {
gs.info('Attempting to reopen incident ' + current.number);
current.state = 12;
current.work_notes = 'The caller requested to reopen the incident.';
current.comments = "Email reply from: " + email.origemail + "\n\n" + email.body_text;
current.update();
} else {
gs.info('Email does not request to reopen incident ' + current.number);
if (current.state == 7) {
gs.info('Incident ' + current.number + ' is closed. Cannot reopen.');
gs.eventQueue("incident.closed.noreopen", current, current.state, previous.state);
current.comments = 'User attempted to re-open this incident. Notification sent to user; incident may not be re-opened.';
current.update();
}
}
} else {
gs.info('Incident ' + current.number + ' is not in resolved state. Skipping reopen check.');
}
} else {
gs.info('Inbound action skipped for non-incident record.');
}
})(current, event, email, logger, classifier);
current.update(); //its required to save the data
If my response has resolved your query, please consider giving it a thumbs up and marking it as the correct answer!
Thanks & Regards,
Sanjay Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2024 10:58 AM
Hi @ElC, I think you are missing the update function call in your script.
current.update();
Thank you,
Swapnil Deo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2024 03:55 PM - edited 07-09-2024 03:56 PM
Hi @ElC ,
The only issue I can see is that you are not updating the data anywhere, please find the updated script-
(function runAction(current, event, email, logger, classifier) {
if (current.getTableName() == "incident") {
gs.info('Processing inbound action for incident record: ' + current.number);
if (current.state == 6) {
gs.info('Incident ' + current.number + ' is in resolved state.');
var subject = email.subject.toLowerCase();
if (subject.indexOf("reopen") >= 0 || subject.indexOf("wieder geöffnet") >= 0) {
gs.info('Attempting to reopen incident ' + current.number);
current.state = 12;
current.work_notes = 'The caller requested to reopen the incident.';
current.comments = "Email reply from: " + email.origemail + "\n\n" + email.body_text;
current.update();
} else {
gs.info('Email does not request to reopen incident ' + current.number);
if (current.state == 7) {
gs.info('Incident ' + current.number + ' is closed. Cannot reopen.');
gs.eventQueue("incident.closed.noreopen", current, current.state, previous.state);
current.comments = 'User attempted to re-open this incident. Notification sent to user; incident may not be re-opened.';
current.update();
}
}
} else {
gs.info('Incident ' + current.number + ' is not in resolved state. Skipping reopen check.');
}
} else {
gs.info('Inbound action skipped for non-incident record.');
}
})(current, event, email, logger, classifier);
current.update(); //its required to save the data
If my response has resolved your query, please consider giving it a thumbs up and marking it as the correct answer!
Thanks & Regards,
Sanjay Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2024 11:15 PM
I have added current.update() but its still not reopening the incident and I get the same error message.
Any other thought what could be the issue here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 12:29 AM
Ignore above comment from me its working fine now. Can't believe I missed update