how to stop Scheduled jobs getting run using inactive user profile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 01:17 AM
Hi Team,
Scheduled Jobs getting run by inactive user as created by user is inactive when scheduled job is getting run.
Please suggest inputs how to avoid this.
As client project security issues , they don't want to run scheduled jobs if created user is inactive.
Regards,
Vineela
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2024 09:03 PM
Hi @Ankur Bawiskar ,
Please suggest , how we can track scheduled jobs whose created by users are inactive.
Is there any way instead of manual check , any OOTB script is checking on this.
Thanks and Regards,
Vineela
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2024 11:37 PM
nope
you need to check manually or write a script to check this.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2024 03:18 AM
Hi Vineela,
The schedule won't run correctly with inactive user in 'Run as' fields, as some access is needed and inactive users doesn't have.
I have seen this situation where the scheduled reports are sent out and only some columns are having value and others doesn't. This happens when admin left the project and 'Run as' field value should be updated with replaced user.
To overcome this you can add a step before deactivating user ,to check whether the user is in the 'Run as' field for any scheduled job or scheduled reports and alert with a notification or stop deactivating that user with an error message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2024 09:04 PM
Hi @Phanindra N ,
Please suggest , how we can track scheduled jobs whose created by users are inactive.
Is there any way instead of manual check , any OOTB script is checking on this.
Thanks and Regards,
Vineela
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2024 11:32 PM
Hi @Vineela1
There is no OOB script, we have to write it on your own and have to implement it. Implementation depends on how you are inactivating the user. If manually inactivating client script or business rule will do, if done via any catalog item you have change the workflow.
Script would be similar to this:
var gr = new GlideRecord('sysauto');
gr.addEncodedQuery('active=true^run_as='+ [sys_id of user inactivating]);
gr.query();
if(gr.next()){
//user is in the 'Run as' field in one or more scheduled jobs or scheduled emails, abort the action and show error message
}