Inbound Action: create new INC if replying to closed INC

JP-ODU
Tera Guru

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:

find_real_file.png

(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?

find_real_file.png

Thanks!

8 REPLIES 8

Sushma R1
Tera Expert

Check if the stop processing checkbox is checked for any other inbound action on inc table 

mark correct or hit helpful if it was 🙂

This was a good call, I noticed there were 2 other inbound actions running on Incident table with stop processing checked off. But... even once I've deactivated those, and have no inbound actions running with stop processing on the Incident table, my attempts to reply to closed incidents to prompt creation of a new one give the same message:

"did not create or update incident using current"

find_real_file.png

I notice other actions are being skipped, and the nomenclature here isn't that it's skipped, merely that it's not working and did not create the record I expected? But I can't figure out more than that, why it wouldn't create the record...

Do not use skip when you can do strict creation and since you have a re-creation use case. See if that works just fine or use execution order as well 🙂

I'm not sure I understand. No setting or line of the script should use skip that I'm aware of, it's just that in trying to compare how this action behaves to others, I note that other scripts are being "skipped," whereas this one is "did not create?" That suggests to me that it's not that conditions aren't being met (thus skipped), but perhaps that something is wrong with my script, itself?

Any idea of how I might get more information for the process than "did not create or update incident using current?" I feel if I knew why it wasn't created, then I could fix that