How to write fix script?

Shashi K
Tera Contributor

I have a requirement when ever an Change is closed configuration item filed must not be empty.

 

How to write in fix script? I want only fix script 

1 ACCEPTED SOLUTION

Chetan Mahajan
Kilo Sage
Kilo Sage

Hi Shashi,

                   If I correct you want to update configuration item field for closed change. once you run fix script whatever changes has empty CI it will get update with some value ? so you can refer below script

updateCI();
function updateCI(){
	try{
		var gr = new GlideRecord('change_request');
		gr.addEncodedQuery('state=3^cmdb_ciISEMPTY'); // state is closed and ci is empty
		gr.query();
		while(gr.next()){
			// your logic of updating here
			gr.setValue('cmdb_ci','b0cb50c3c0a8000900893e69d3c5885e');
			gr.update();
		}
	}
	catch(ex){
		gs.info(ex);
	}
}

Kindly mark response correct and helpful if applicable

View solution in original post

10 REPLIES 10

JenniferLois
Tera Contributor

I am also facing this problem and I can't find any solution. I researched it online to find some solution but unfortunately I couldn't. I want to fix my website for students who want UK Assignment Help. I hope I can find it as soon as possible so I can get back to work and fix these issues. Thanks for posting about this problem though!