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.

change the incident state from resolved to in progress if the user submitted the survey

mohammed-ahmad
Tera Contributor

i have a requirement that if the user answered the question ( have your issue been resolved ? ) with no it should make the incident go from the resolved state to in-progress state , can anyone help me with this and if here is a solution with no scripting included that would be much better thanks 

3 REPLIES 3

Harshal Aditya
Mega Sage

Hi @mohammed-ahmad  ,

 

Hope you are doing well.

 

I am not sure if this can be implemented without scripting.

But with after business rule you can definitely achieve the required outcome 

Write a after BR on asmt_assessment_instance table with proper conditions.

 

Please mark this response as correct or helpful if it assisted you with your question.

Regards,
Harshal

can you kindly guide me so i can achieve this requirement , if you can provide the script i will be much appreciated  

Harshal Aditya
Mega Sage

Hi @mohammed-ahmad  ,

 

Please refer below script -

 

var getAnswer = new GlideRecord("asmt_assessment_instance_question");
	getAnswer.addEncodedQuery("instance="+current.sys_id);
    getAnswer.addQuery("metric","sys_id of metric"); // Replace with sys_id of the metric record i.e sys_id of question in the survey
	getAnswer.query();
	if(getAnswer.next()){
		if(getAnswer.value == "reopen"){ // replace with appropriate value
			var updateInc = new GlideRecord("incident");
			updateInc.get(getAnswer.task_id);
			updateInc.state = 3;  // replace with appropriate value of inprogress
			updateInc.update();
		}
	}

 

Please mark this response as correct or helpful if it assisted you with your question.

Regards,
Harshal