setWorkflow(false) not working in scoped HR app

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2025 08:56 AM
Here is a thing.. There is a business rule in scoped app that adds a comment when a record is updated. We need to stop this BR while we are running a scheduled script.
Commonly, we use setWorkflow(false) but it is not working. I tried to create a global script include and then call this script through schedule, still no luck.
Did anyone faced similar issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2025 09:15 AM
are you using setWorkflow(false) on global or some other scope?
if your business rule is created in same scope i.e. custom one then it should be allowed
if your BR is in another scope then it won't work
setWorkflow() cross-scope access issue
setWorkflow api cannot be used for cross scoped applications.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-09-2025 10:25 AM
Do not use a global script include for scoped HR work. Much better to insure you create it under the correct scope and that the first two lines of the script include are similar to this to extend the global functions into the scope
var FetchUserDetails = Class.create();
FetchUserDetails.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {