How to write a fix script to close the changes that are assigned to specific users?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2024 11:36 AM
I need to close the change requests that are assigned to x,y,z users but unfortunately their user records are not presented in user table but i can able to see them in the change list view as seen the below.
help me to write a code to query records through fix script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2024 11:56 AM
Can you try using updated by?
If not list edit is all I can think of.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2024 09:49 PM
You mean directly closing them through list?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2024 03:18 AM
Hi @Manikantahere ,
if those changes are irrelevent to your business and if you have admin access you can close them via the script given by @Sai_Charan_K , that must work.
before you execute such script mark sure to pass the right value in the encoded query and cross verify the counts in list view before execution.
i hope this helps...
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2024 08:24 PM
Hi @Manikantahere,
Assuming that the user's mail ids are available in the created by column, I have written a script, Please try this script in the dev instance and verify.
var gr = new GlideRecord("change_request");
gr.addEncodedQuery("sys_created_by=felix.bait"); //filtered using created by email and copied the query
gr.query();
while (gr.next()) {
gs.print(gr.number);
gr.state = "3"; //closed state value
gr.close_code = "successful"; //close code value
gr.close_notes = "Test Successful"; //close notes comments
gr.setWorkflow(false);
gr.update();
}
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.
Thanks and Regards,
K. Sai Charan