Business rule(s) running twice when the 'Execute function' checkbox is checked.


Description

Overview

Business rules can run twice when the 'Execute function' checkbox is checked.

Subject

When the 'Execute function' (execute_function) checkbox is checked, the business rule script will have an "immediate" function declaration, for example: 

function onAfter(current, previous) { 

or 
function onBefore(current, previous) { 

This function will get added to the script that will be evaluated. However, if there is a script in the BR script field which includes the function as well, it will get added to script that goes through the evaluation twice. 

The 'Execute function' is a legacy field and ServiceNow does not recommend having it checked on business rules.

Additional Information

The 'Execute function' is a legacy field and ServiceNow does not recommend having it checked on business rules.