openGlideRecord in Declarative action for service operation workspace is not working

Ujjwal1
Tera Contributor

hi,

i have used Declarative Action for Service Operation Workspace, to create new  incident.

Ujjwal1_0-1751462899657.png

 

issue: newly created incident is not opening in new tab. code : action.openGlideRecord(inc);

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 (GlidePluginManager.isActive("sn_itsm_gen_ai") && current.chat_summary && (current.chat_summary.toString()).length < 4000) {
		inc.description = current.chat_summary;
	}
	inc.origin_table = "interaction";
	inc.origin_id = current.sys_id;
	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);
}

 Please suggest.

4 REPLIES 4

pavani_paluri
Giga Guru

Hi @Ujjwal1 ,

 

Could you please replace your action.openGlideRecord(inc) code with below:

 

action.openNewTab({
id: inc.sys_id,
table: 'incident',
view: 'workspace',
title: 'Incident ' + inc.number
});

 

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Pavani P

hi @pavani_paluri  - thanks  for reply. But solution did not work. it is not redirecting to new incident.

Hi @Ujjwal1 

Can you try this:

action.openNewTab({
id: inc.sys_id,
table: 'incident',
title: 'Incident ' + inc.number
});

 

Please try to log the incident sysid and check whats coming.

 

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Pavani P

hi
i have tried this . still same issue
sys_id is returning Incident sys_id.