- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2019 07:46 AM
Hi Team,
Can someone help me with the best practices on fix scripts & Scheduled Jobs?
Regards,
Alok sahu
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2019 08:06 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2019 05:31 AM
Thank you Ankur 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2019 06:29 AM
Hi Alok,
Can you also mark answer as correct and helpful. Thanks in advance.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2022 05:18 PM
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
