Fix Script - Set Value of Field

ErinF
Tera Expert

Hello! 

We have a need to update some closed HR Cases with a new close code. 

I have written a fix script to update the close code, but its unable to execute due to a data policy. 

Is there a method to set data policy to false? I read that setUseEngines cannot be used in a scoped app. 

Any ideas?  

var hrCase = new GlideRecord('sn_hr_core_case_relations');
hrCase.addQuery('u_close_code',"Written Warining");
hrCase.query();
	while(hrCase.next()){
	hrCase.u_close_code="Written Warning";
	hrCase.update();
}
1 ACCEPTED SOLUTION

sachin_namjoshi
Kilo Patron

You can create and execute your fix script in global scope and then use setUseEngines() method to disable data policy.

 

Regards,

Sachin

View solution in original post

5 REPLIES 5

shwetapj
Tera Expert

Hi,

add hrCase.setWorkFlow(false); just before hrCase.update() and try once.

 

Unfortunately, no luck. 

Allen Andreas
Tera Patron

Hi,

It'd be helpful to know what the data policy is checking for/enforcing?

Alternatively, you may want to convert the policy to a business rule, etc. instead.

or disable it for this moment, run fix script, then turn it back on.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi @Erin Fryman 

Thanks for marking my reply as Helpful.

If a particular reply helped guide you Correctly, please also mark it as Correct.

Thanks and take care! 🙂


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!