CAD · Question #201
How do you prevent a business rule from running on a specific condition?
The correct answer is B. Use the "Script" field to return false. To dynamically prevent a Business Rule from executing based on specific conditions, you can use the 'Script' field to implement logic that aborts the transaction or stops further processing.
Question
How do you prevent a business rule from running on a specific condition?
Options
- AUse the "Condition" field of the Business Rule to specify when it should not run.
- BUse the "Script" field to return false.
- CSet the "Active" field to false.
- DCreate an exception rule in the Business Rule.
How the community answered
(46 responses)- A2% (1)
- B96% (44)
- D2% (1)
Why each option
To dynamically prevent a Business Rule from executing based on specific conditions, you can use the 'Script' field to implement logic that aborts the transaction or stops further processing.
The "Condition" field specifies *when* the Business Rule *should* run, not when it *should not*; you would typically define conditions that, if true, allow the rule to proceed.
Within the 'Script' field of a Business Rule, you can write JavaScript logic that evaluates conditions and then, if the conditions are met to prevent execution, use `current.setAbortAction(true)` for 'before' rules or simply `return` for 'after' rules to stop further processing.
Setting the "Active" field to false permanently disables the Business Rule entirely, which is not suitable for preventing it from running only on a *specific condition*.
There is no standard feature called "exception rule" directly within a Business Rule designed for this specific purpose of conditional prevention.
Concept tested: Business Rule conditional execution control
Source: https://docs.servicenow.com/bundle/utah-application-development/page/script/business-rules/concept/c_BusinessRules.html
Topics
Community Discussion
No community discussion yet for this question.