Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

What is the Best Practice on fix scripts & Scheduled Jobs?

Alok21
Giga Expert

Hi Team,

Can someone help me with the best practices on fix scripts & Scheduled Jobs?

Regards,

Alok sahu

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Alok,

Both have their own advantages and limitations

 

 

Scheduled Jobs
1) always use setLimit() to test for few records whether update/delete happening or not; then remove this after confirmation

2) always try to use autoSysFields(false) for avoiding update to updated_by and updated_on fields

3) Always use try catch block so that even if error comes it will proceed and not stuck at that place

Fix Scripts

1) Always use try catch block so that even if error comes it will proceed and not stuck at that place

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

7 REPLIES 7

Thank you Ankur 🙂

Hi Alok,

Can you also mark answer as correct and helpful. Thanks in advance.

Regards

Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thanks Ankur.

 

I believe we can also make sure to use setWorkflow(false) in some cases where we need to update only few records to correct the information with specific value on those records through fix script. Doing this will make sure that no other BR or script engine will execute and make unnecessary changes on those records. 

 

Regards,

Kartik