The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Not getting Interaction records to update when SAVE button is clicked

EricG
Kilo Sage

I'm having trouble finding out why this is not working on interactions.

As a requirement, I've been tasked to mimic call actions on Interactions, so that help desk agents don't need "retraining".

The behaviour wanted is:

when agent sets "Interaction Type" (Create Incident, Create Request, Status Check) and then clicks the "Save" button, the ticket will close and they are redirected to the ticket.

I've got the Create Incident and Create Request to work.  Status Check only associates the Interact to the ticket.

the Interaction Description is not added to the ticket.

State remains open and the are not redirected.

I'm sure I've missed something minor.

My script is:

action.setRedirectURL(current);

if(current.u_interaction_type=='request'){
	//Working lines of code
}
else if(current.u_interaction_type=='incident'){
	//Working lines of code
}
else if(current.u_interaction_type=='status'){
	var statTck = new GlideRecord('task');
	statTck.addQuery('sys_id',current.u_associated_record);
	statTck.query();


	if(statTck.next()){
	     statTck.work_notes = current.u_description;

	     statTck.update();
	}

	var rltRecord = new GlideRecord("interaction_related_record");
	rltRecord.newRecord();
	rltRecord.interaction = current.sys_id;
	rltRecord.document_table = 'task';
	rltRecord.task = current.u_associated_record;
	rltRecord.update();

	action.setRedirectURL(current);
	current.state ="closed_complete";
	current.update();
	}
}

else{
	current.update();
}

 

2 REPLIES 2

Sukraj Raikhraj
Kilo Sage

I would move the line action.setRedirectURL(current) down two lines, update and then redirect..

ok.  Tried that and still nothing.

I even reviewed my other lines and adjusted accordingly.  Still not updating Associated record, nor redirecting nor updating interaction to Close Complete.

 

Updated Code:

else if(current.u_interaction_type=='status'){
	alert('The Save button pressed');
	var statTck = new GlideRecord('task');
	statTck.addQuery('sys_id',current.u_associated_record);
	statTck.query();

	if(statTck.next()){
		//gs.log("eric - the ticket is - "+current.u_associated_record)
		//statTck.comments = current.u_description.toString();
		statTck.work_notes = current.u_description;
		gs.log('eric - the notes should see '+current.u_description);
		statTck.update();
	}

//REVISED TO MIMICK WORKING CODE ON INC OR RITM CREATE
	current.state ="closed_complete";
	current.update();
	
	var rltRecord = new GlideRecord("interaction_related_record");
	rltRecord.newRecord();
	rltRecord.interaction = current.sys_id;
	rltRecord.document_table = 'task';
	rltRecord.task = current.u_associated_record;
	rltRecord.update();
	
	action.openGlideRecord(statTck);
	}
}