how to update a read-only field once the change request is closed

Sahana Chandras
Tera Contributor

Hi,

Our change request is configured in such a way that once any change request is closed, all the fields become read-only.

Now we have a requirement where, we need to update the close code from "successful" to "successful with issues" if any incident has been created related to change after the closure of the change request.

Kindly help me through this as i am new to scripting.

find_real_file.pngfind_real_file.pngThanks in Advance!

1 ACCEPTED SOLUTION

SumanthDosapati
Mega Sage
Mega Sage

Hi @Sahana Chandrashekara 

You can write a business rule on incident table as below 

find_real_file.png

 

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

	var gr = new GlideRecord('change_request');
	gr.addQuery('sys_id',current.caused_by);
	gr.query();
	if(gr.next())
		{
			gr.close_code = "successful_issues"; //check value of successful with issues.
			gr.update();
		}

})(current, previous);

find_real_file.png

 

 

Mark as correct and helpful if it works.

Regards,

Sumanth

View solution in original post

5 REPLIES 5

Sahana Chandras
Tera Contributor

Hi Sumanth and ideamax,

 

i tried doing as you suggested, but still the close code is not updating