Create Incident UI Action on Interaction table is creating Incident Record but not opening incident

Rajini2
Mega Sage

Service Operations Workspace:

There is a Create Incident UI Action on Interaction table is creating the incident with all the values but stays in the details section. I was expecting it to open the incident record as the last line of the script is action.openGlideRecord(inc).

 

Because of this behavior, our Agent is not sure if the incident is created, so had to do several clicks to get around the inc#. (Related records tab > Related Tasks > inc#) 

 

This is OOB script and I want the Incident Record to open up within SOW right after creation.

var canCreateIncident = false;
if ((current.isNewRecord() && current.canCreate()) || (!current.isNewRecord() && current.canWrite()))
	canCreateIncident = current.update();
else
	canCreateIncident = true;

if (canCreateIncident) {
	var inc = new GlideRecord("incident");
	inc.initialize();
	inc.caller_id = current.opened_for;
	inc.short_description = current.short_description;
	if (gs.getProperty("com.snc.incident.create_from_interaction.save") === 'true') {
		inc.work_notes = gs.getMessage('Incident created from Interaction {0}', current.number);
		var incSysId = inc.insert();
		if (incSysId) {
			if (gs.getProperty('com.snc.incident.create_from_interaction.copy_attachments' , false) === 'true') {
				var serviceInteractionUtils = new global.ServiceInteractionUtils();
				serviceInteractionUtils.copyAttachments(current, inc);
			}
			var interactionRelatedGR = new GlideRecord("interaction_related_record");
			interactionRelatedGR.initialize();
			interactionRelatedGR.interaction = current.sys_id;
			interactionRelatedGR.document_table = 'incident';
			interactionRelatedGR.document_id = incSysId;
			interactionRelatedGR.insert();
		}
	}
	action.openGlideRecord(inc);
}

 

There is a "Create UR" ui action, a similar functionality and that opens the record in SOW.

1 REPLY 1

Amit Verma
Kilo Patron
Kilo Patron

Hi @Rajini2 

 

Please try with setRedirectURL action. Refer https://developer.servicenow.com/dev.do#!/reference/api/vancouver/server/no-namespace/ActionAPIBoth#...

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.