Thank you for your feedback.
Form temporarily unavailable. Please try again or contact to submit your comments.
  • Madrid
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store

Create a business rule

Log in to subscribe to topics and get notified when content changes.

Create a business rule

You can create any type of business rule to run when a record is displayed, inserted, updated, or deleted, or when a table is queried.

  1. Navigate to System Definition > Business Rules.
  2. Click New.
  3. Fill in the fields, as appropriate.
    Note: You might need to configure the form to see all fields.
    Table 1. Business Rule fields
    Field Description
    Name Enter a name for the business rule.
    Table Select the table that the business rule runs on.
    Note: The list shows only tables and database views that meet the scope protections for business rules. Business rules defined for a database view can run only on Query. A business rule for a database view cannot run on insert, update, or delete.
    Application Application that contains this business rule.
    Accessible from Scope protection for a global business rule.
    Note: This field is visible only when the Table field is set to Global. It does not apply to rules that run on specific tables.
    Active Select this check box to enable the business rule.
    Advanced Select this check box to see the advanced version of the form.
    When to run

    [Advanced] Select when this business rule should execute: display, before, async, or after the database operation is complete.

    Note: Consider setting the Priority for async business rules as the system uses this value when creating the associated scheduled job.
    Order Enter a number indicating the sequence in which this business rule should run. If there are multiple rules on a particular activity, the rules run in the order specified here, from lowest to highest.
    Insert Select this check box to execute the business rule when a record is inserted into the database.
    Update Select this check box to execute the business rule when a record is update.
    Delete Select this check box to execute the business rule when a record is deleted from the database.
    Query Select this check box to execute the business rule when a table is queried.
    Filter Conditions Use the condition builder to determine when the business rule should run based on the field values in the selected Table. You can also use the Condition field to build a condition with a script.
    Role Conditions Select the roles that users who are modifying records in the table must have for this business rule to run.
    Set field values Set values for fields in the selected Table using the choice lists:
    • The field
    • The assignment operator:
      • To: An exact value
      • Same as: The value of another field
      • To (dynamic): A value relative to the user configuring the business rule or a user with a specific role
    • The value
    Add message Select this check box and enter a message that appears when this business rule is run
    Abort action

    Select this check box to abort the current database transaction. For example, on a before insert business rule, if the conditions are met, do not insert the record into the database.

    If you select this option, you cannot perform additional actions on the record, such as setting field values and running scripts. You can still display a message to users by selecting the Add message check box and composing the message.

    Condition Create a JavaScript conditional statement to specify when the business rule should run. By adding the condition statement to this field, you tell the system to evaluate the condition separately and run the business rule only if the condition is true. If you decide to include the condition statement in the Script field or if you use the condition builder, leave this field blank. To have the instance reevaluate the condition statement a second time before running an async business rule, add the system property glide.businessrule.async_condition_check and set the value to true.
    Create a script that runs when the defined condition is true. The system automatically populates this field with a function name that matches the When value.
    • onAfter
    • onAsync
    • onBefore
    • onDisplay
    Note: The function name must match the When value.

    For more information and examples, see Scripting in Business Rules.

    Related list: Versions
    Versions Shows all versions of the business rule. Use this list to compare versions or to revert to a previous version.
  4. Click Submit.