Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Agent Workspace UI Action 'Create Incident'

Asim2462
Tera Contributor

Hi,

 

I am working on the Service Operation workspace, on the OOB UI Action 'Create Incident' from an Interaction.

 

I have updated it to copy over the 'Opened By' field however, it is not working.

 

I have another field 'caller_id' and this copies over with no issues as well as a number of other fields like short description and contact number.

 

I have also tried to set the value using 'inc.setValue('opened_by', current.opened_for);' but this hasn't worked either.

 

Where am I going wrong with this?

 

Thanks,

Asim

 

 

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.u_interaction_affected_user; //Copies over fine
	inc.opened_by = current.opened_for; //Does not copy over
	inc.short_description = current.short_description; //Copies over fine
	inc.description = current.u_interaction_description; //Copies over fine
	inc.u_contact_number = current.u_interaction_contact_number; //Copies over fine
	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) {
			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);
	new InteractionRelationshipUtil().copyAttachments(current, inc);
}

 

 

 

0 REPLIES 0