May 28, 2023

After Business Rules in ServiceNow

 There are four types of Business Rules in ServiceNow

  1. Before business rules
  2. After business rules
  3. Display business rules
  4. Async business rules
In ServiceNow, an "after" Business Rule is a customization mechanism used to perform automated actions or logic after a record is inserted, updated, or deleted in a specific table. It is a server-side script that executes after the database transaction has occurred.

The purpose of an "after" business rule is to extend and customize the behavior of the platform by defining additional actions or validations based on changes made to records. It allows you to automate processes, enforce business rules, perform calculations, update related records, send notifications, or integrate with other systems after the record has been saved in ServiceNow. It gives you the ability to write server-side scripts using JavaScript to interact with the ServiceNow platform and perform various operations on the affected record or related records.

By utilizing "after" business rules effectively, you can enhance the functionality and automation capabilities of ServiceNow, aligning it with your organization's unique requirements and processes.

Here are some key points about "after" business rules in ServiceNow:
  • Event Trigger: An "after" business rule is triggered after a specific database operation, such as "insert", "update", or "delete", is performed on a record in the associated table.
  • Execution Timing: The script associated with the "after" business rule executes after the database transaction has completed. This means that the record changes have already been committed to the database.
  • Server-Side Execution: "After" business rules run on the server-side of the ServiceNow platform. They are implemented using server-side JavaScript and have access to the Glide API, which provides a wide range of functionalities for interacting with the platform's data and services.
  • Context and Conditions: You can define conditions or criteria for the business rule to execute. These conditions can be based on the values of specific fields, the user who made the changes, or any other relevant data in the record.
  • Script Logic: The script associated with the "after" business rule can perform a variety of operations, such as querying and updating other records, calculating values, validating data, sending notifications, logging information, or triggering workflows.
  • Extension and Customization: "After" business rules allow you to extend and customize the behavior of ServiceNow beyond the out-of-the-box functionality. They provide a way to implement specific business logic or automate actions based on changes to records.


Some common use cases for "after" business rules include:

  • Field calculations or derivations: You can use the business rule to compute values for certain fields based on the values of other fields. For example, you can automatically calculate the total cost of an order based on the quantity and unit price.
  • Data validation: You can validate the data entered in the record against certain criteria or business rules. For instance, you can check if a user is eligible for a specific service based on their department or role.
  • Sending notifications or alerts: The business rule can trigger notifications or alerts to relevant stakeholders based on the changes made to the record. This can include sending emails, generating notifications within the ServiceNow platform, or triggering external integrations.
  • Updating related records: You can use the business rule to update other records that are related to the changed record. For example, when an incident is resolved, you can automatically update the associated change request or notify the requester.
  • Logging or auditing: The business rule can log the changes made to the record or generate audit records for tracking purposes. This can help in maintaining a record of data modifications and monitoring system activity.


0 comments: