- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-26-2017 03:36 AM
We are developing a servicenow enforcer. And facing a business rule trigger problem.
For example, there are 2 before query business rules, one on incident table, one enforce on caller table.
When incident business rule(filter query) are executing, some code in this BS(business rule) will trigger caller table BS executing.
The "some code" is relate to GlideRecord query, we query caller table( or do join query on calller table).
Anybody ever encounter this problem? How to ignore the BS executing triggered by GlideRecord?
Thanks in advance!
Leo
Solved! Go to Solution.
- Labels:
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2017 06:55 AM
thanks for sharing that Ray. I personally was not aware that it will also prevent query business rules.
Using a .setWorkflow(false) to prevent business rules from executing is rarely used because in most cases you want these to execute. For that reason, you have to use it with caution (specially if it doesn't execute query business rules , which also work like acls to restrict what data is retrieved during a query of a table)
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-26-2017 10:55 AM
Hi Ray,
I'm not fully sure I understand your scenario, but when you're doing an update or insert in a GlideRecord you can include a line so that such operations do not trigger business rules. That operation is .setWorkflow(false)
GlideRecord - Global - search for setWorkflow
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-26-2017 10:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2017 12:42 AM
Thank you Berny.
'setWorkflow' is used to enable/disable the running of any business rules that may be triggered by a particular update.
I found that it works not only for "update" but also for "query".
For example, The incident table bs code is:
var gr = new GlideRecord('ecc_action');
gr.query();
Then this query will trigger the ecc_action table bs.
Change the incident table bs code to:
var gr = new GlideRecord('ecc_action');
gr.setWorkflow(false);
gr.query();
The ecc_action table bs will not be triggered.
Is it normal? Why the servicenow official not mention the "query" action?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2017 06:55 AM
thanks for sharing that Ray. I personally was not aware that it will also prevent query business rules.
Using a .setWorkflow(false) to prevent business rules from executing is rarely used because in most cases you want these to execute. For that reason, you have to use it with caution (specially if it doesn't execute query business rules , which also work like acls to restrict what data is retrieved during a query of a table)
Thanks,
Berny