creating an incident from a case.

Nishant16
Tera Expert

I am creating an incident from a Case using the OOB UI action 'Create Incident', however the relationship on Case record is not getting created. i.e in the related records the 'incident' field is still blank.

On the incident record though the parent is correctly populated with the originating case number.

How can i check and update the Parent Case record to show the incident field with incident number created from case?

7 REPLIES 7

PVSK
Mega Expert

OOTB script include "ServiceManagementIncidentUtils" should automatically set the incident field value on case record.

Could you check in your instance if either the "Create Incident" UI action or the script include "ServiceManagementIncidentUtils" are customized?

Hello

i see the Create incident UI action is customized since its a requirement to create multiple incidents from a case.

Now, my requirement is to update the comments added on the Incident to be added as worknotes to the parent case, However due to no reference i am not able to sync them.

Below is the customized UI action, please help me how can i sync the comments to case from incident?

Create Incident

Condition: new sn_cs_sm.ServiceManagementIncidentUtils().canCreateIncident(current)

current.update();

var caseID = current.sys_id;
var inc = new GlideRecord("incident");
inc.initialize();
//inc.company = current.account;
inc.company = 'gz9785tyv6f0ba989yh65aa598hfs67';
//inc.caller_id = current.contact;
inc.caller_id = gs.getUserID();
inc.short_description = current.short_description;
inc.parent = caseID;
inc.description = current.description;
inc.contact_type = 'self-service';
action.openGlideRecord(inc);

i tried adding comments of incident using the below Business rule in my PDI which works fine, but is not working in my instance since it could not reference the incident number

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	
	var caseGr = new GlideRecord("sn_customerservice_case");
		caseGr.addQuery("incident", current.sys_id); //Copy Worknotes from Case to Incident from which it incident was created.
		caseGr.query();
		while(caseGr.next()) {
			caseGr.work_notes = 'IT TASK update – '+current.number+ ' has additional comments - '+ current.comments;
			caseGr.update();
		}


})(current, previous);

 

How and what should i do so that all the associated incidents on a case should copy the comments to the parent case?

Hi @Nishant 

 

As per the code provided by you, the case id should be set by the line:

inc.parent = caseID;

Please confirm whether Case is populated on Incident or not?

 

Thanks and regards,

Kartik