What is the use of setWorkflow(false)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2018 01:53 AM
What is the use of setWorkflow(false)
- 43,065 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2018 01:58 AM
Hi,
Once you place it in your code before the update or insert query, this will make sure that none of the Business rule written on your table will run.
Please refer the link for more details.
Thanks
Gaurav

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-23-2018 01:59 AM
Check 4. Use setWorkflow(false) and autoSysFields(false) in below thread
When you are mass updating records with a background script, sometimes you don't want to run the business rules/workflow on every record you updated or have your name and the last updated time be when you updated it
Background Scripts — ServiceNow Elite
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2024 01:48 AM
The setWorkflow(false) is a method used in ServiceNow scripting. Here's a summary of its use: - It is used to prevent any business rules from running that are set to run on database changes. - It is often used when you want to update a record in a script without triggering the business rules or workflows associated with that update. - This method is particularly useful when you want to make changes to a record in a controlled manner, without invoking additional processes. - It is used in GlideRecord queries. For example, if you have a GlideRecord 'gr', you can use gr.setWorkflow(false) before gr.update(). - It is important to note that using setWorkflow(false) only applies to the current server-side script in which it is used. It does not globally turn off workflows. - It is also important to use this method judiciously, as it can lead to data inconsistencies if business rules are bypassed that are necessary for maintaining data integrity. nowKB.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2024 03:16 AM
Hi
In ServiceNow, the setWorkflow(false) method is used to disable the execution of business rules, workflows, and any other automatic processes during a GlideRecord update. It essentially allows you to perform updates on a record without triggering any associated workflows or business rules.