- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2019 12:55 AM
can anyone explain me why using current.setWorkflow(false) should not be followed or is it an unethical way?
and if i use would it be a wrong method for a developer
curious to know just for knowledge
thanks
Solved! Go to Solution.
- Labels:
-
Team Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2019 03:23 AM
Hi,
In this current case, where the requirement is to have CR state to be closed (instead of cancelled) When it is rejected.
The OOB BR restricts the change of state.
Hence suggested to use setworkflow(false) in the run script so that the Br does not run on this record and the state is changed to closed.
Kindly mark the comment as a correct answer and helpful if it helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2019 12:59 AM
Hi there,
Completetly up to your situation/need. It can be valid to use setWorkflow(false) sometimes. For example, if you are updating records and don't want Business rules or Workflows to be triggered.
It would be different if you would always use this. That would be odd 🙂 Though it really depends on your situation if it's useable or not.
For the usage, see:
https://developer.servicenow.com/app.do#!/api_doc?v=newyork&id=r_GlideRecord-setWorkFlow_Boolean
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2019 01:21 AM
hi mark,
Am using this in my change request workflow where i set the value false so is it right way to proceed

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2019 01:42 AM
The question: what is the need for your query? Just for every GlideRecord query... absolutely not! If it's for a valid reason, like on purpose you don't want Business rules to execute, oke fine.
So again, why do you want to use setWorkflow(false)? What is your need? Or is it just because someone told you about this option and your thinking that could be nice? Though actually there's no reason for applying it?
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2019 03:00 AM
I have customized change request workflow where after approver's rejection it goes new state ideally but customization it goes to closed state.
however, i used current.setworkflow(false) in my wf
so is this the correct way