SOW: Incidents created from Interactions are not showing in Related Tasks related List

dattanarend
Tera Expert

Hi Community,

I'm facing an issue where, while creating an incident from an interaction using the Create Incident UI action, the incident is not appearing under the Related Tasks section of the interaction. Additionally, no record is being created in the interaction_related_record table.

I followed the solution provided in this KB article: KB0852997, but unfortunately, it didn't resolve the issue.

Has anyone encountered a similar problem or can suggest a fix?

Thanks in advance for your help!



5 REPLIES 5

Laveena-Agarwal
Kilo Sage

Hi @dattanarend 

1. Ensure the below out-of-the-box (OOB) code is present.
If it is already in place, add logs inside the "if" statement to identify where it might be failing.

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);
}

 2. If the issue still persists, use the Access Analyzer to check permissions on the interaction_related_record  table and grant the necessary permissions accordingly.

Yes, the out-of-the-box code is in place. Interestingly, it's working as expected in Service Portal (SOW) — the incident gets created and appears under Related Tasks, and a record is inserted into the interaction_related_record table.

However, when performing the same action from the native view of the interaction, the incident gets created but is not showing under Related Tasks, and no corresponding record is being created in the interaction_related_record table.

Hi @dattanarend 

In the OOB setup, the "Create Incident" button is not enabled on the Interaction form in Platform View. Instead, you’re expected to use the "Associated Record" UI Action.

However, in my OOB instance, both buttons work as expected, and the records are visible in the related list as well.

Could you please check "Create Incident" button in your PDI and compare the code and permissions accordingly

The associated record functionality is working as expected in the form view, and I have also tested the same code in my PDI where it behaves correctly. I’m unable to determine why it is exhibiting this inconsistent behavior in the current instance.