Wednesday, 4 August 2021

ServiceNow Scheduled Job running permission

 A scheduled job that runs a script will not evaluate permissions when selecting data unless you use a GlideRecordSecure object.

https://docs.servicenow.com/bundle/jakarta-application-development/page/script/glide-server-apis/concept/c_UsingGlideRecordSecure.html

So if permissions matter to what you are doing then you need to use that.  Otherwise the system will allow the code to do what ever the code wants to do and will log it as the user who is listed in the "Run as" field. (Run as needed to be added in Form -> Form layout)

Since the job is running as a user when you check for roles it will return based on the user that the job is running under.

So depending on what you are trying to do will tell you how to write the code, but in general server side code can do what ever it wants and ACL's will not matter.


https://community.servicenow.com/community?id=community_question&sys_id=c0db1807dbe7a810fa192183ca961942


https://community.servicenow.com/community?id=community_question&sys_id=06ddbb43db8c2010f21f5583ca9619ae




OOB (by default) Scheduled Jobs require a admin role to run but you can anytime edit the "Scheduled Jobs" module from left navigation and add other role to access the Scheduled Jobs.

https://community.servicenow.com/community?id=community_question&sys_id=6160d729dbdcdbc01dcaf3231f961988



No comments:

Post a Comment