Use PDIs? Take our 5-minute survey to help shape the PDI roadmap.

Unable to close change request

shivanib56
Tera Contributor

As a Change User,

While I am trying to close the change the requested by field and the assigned to field is not reflecting when I checked at backend both the field has inactive users assigned to it.
Now with further investigation, there is a business rule that is blocking it and there is a inactive_user_visiblity role that needs to be added.

since I cannot deactivate the business rule nor can I provide the role to the users what is the best practice to close the changes.

1 ACCEPTED SOLUTION

Ehab Pilloor
Giga Sage

Hi @shivanib56,

 

Use Background script/Fix Script to assign the Change to you and Close the change. 

var gr = new GlideRecord('change_request'); //table name
gr.addQuery('sys_id', 'ADD_UR_RECORD_SYS_ID');
gr.query();
if(gr.next()) {
gs.print(gr.number); //number is the element/column
gr.stage = ""; // add value of the phase
gr.state = "4"; // add value of the state
gr.setWorkflow(false);
gr.autoSysFields(false);
gr.update();
}

 

Please Accept this response as Solution if it assisted you with your question & Mark this response as Helpful.

 

Kind Regards,

Ehab Pilloor

View solution in original post

3 REPLIES 3

abbasshaik4
Tera Sage

Hello @shivanib56,


Two ways we can do, refer to the below steps:

You can assign those changes to yourself and cancel those changes try it in sub-prod environments or by using the background script please refer to the link below:
Solved: Cancellation of Requests - ServiceNow Community

 

If it is helpful, please mark it as helpful and accept the correct solution by referring to this solution in the future it will be helpful to them.

Thanks & Regards,

Abbas Shaik

Ehab Pilloor
Giga Sage

Hi @shivanib56,

 

Use Background script/Fix Script to assign the Change to you and Close the change. 

var gr = new GlideRecord('change_request'); //table name
gr.addQuery('sys_id', 'ADD_UR_RECORD_SYS_ID');
gr.query();
if(gr.next()) {
gs.print(gr.number); //number is the element/column
gr.stage = ""; // add value of the phase
gr.state = "4"; // add value of the state
gr.setWorkflow(false);
gr.autoSysFields(false);
gr.update();
}

 

Please Accept this response as Solution if it assisted you with your question & Mark this response as Helpful.

 

Kind Regards,

Ehab Pilloor

mayankkumar
Mega Patron

Hi @shivanib56,
You can use gr.setWorkflow(false) and gr.autoSysFields(false) in the background script before updating the record. This will prevent the Business Rules from executing while the record is being updated, allowing the record to be updated/closed successfully.
----------------------------------------------------------------------------------------------------------------------------------------
Please mark this response helpful and accept as solution
Thanks & Regards
Mayank