(Rest Smart Connector 🔌) Salesforce Business Rules Engine
home
Salesforce Business Rules Engine API Documentation
Remember learn rapidly the API first in Postman Salesforce Developers Collection
https://documenter.getpostman.com/view/12721794/TVmFjfuh#031e837c-2129-4e99-9f35-c794b313984c
https://help.salesforce.com/s/articleView?id=sf.business_rules_engine.htm&type=5
Business Rules Engine
Simplify determining eligibility or qualification and automate complex decision-making to find solutions faster using Business Rules Engine. The key components of Business Rules Engine are expression sets and lookup tables. Decision matrices and decision tables together constitute lookup tables.
REQUIRED EDITIONS
Available in: Lightning ExperienceAvailable in: Enterprise, Unlimited, and Developer Editions for Industries clouds that have Business Rules Engine enabled
Use a Business Rules Engine component or a combination of components to design business rules to provide automated business solutions in a workflow created using any tool. Business Rules Engine is a suite of services, components, and objects that can be used to create business rules that perform complex lookups and calculations.
Business Rules Engine components are available as part of Flows and OmniStudio. Also, you can use Connect APIs to integrate Business Rules Engine with any workflow created using custom or third-party tools. The workflow that you use to gather inputs passes the inputs to Business Rules Engine, which then returns the outcome to the workflow that called the Business Rules Engine component.
WORKFLOW TOOL OR PROCESSBUSINESS RULES ENGINE INTEGRATIONFlowExpression sets, decision matrices, and decision tables, which are components of Business Rules Engine, are available as actions in Flow. Invoke decision matrices and decision tables as part of an expression set that you invoke in a flow, or independently in flows.OmniStudioExpression sets and decision matrices are available as actions in OmniStudio. If Business Rules Engine is available for your cloud and you also have OmniStudio enabled, you can call Expression Set Action and Decision Matrix Action from integration procedures and OmniScripts.Custom or third-party toolsUse the Connect APIs in Business Rules Engine to invoke expression sets and lookup tables in workflows that you create in custom or third-party tools.How Business Rules Engine Components Integrate with Workflow Tools
Here's how the components in Business Rules Engine integrate and interact with workflows that are created using various tools and processes.
- Get Started with Business Rules EngineBusiness Rules Engine lets you build powerful, scalable lookups and calculations to automate complex decisions. Rules created with Business Rule Engine are easy to maintain, and integrate directly with Flow, OmniStudio, and third-party workflow tools using connect APIs.
- Learn and ExploreLearn how Business Rules Engine can help your business and customers. Understand its core functionality, create a trial org, and learn how to get started.
- Set Up Business Rules EngineConfigure your users to use Business Rules Engine and assign permission sets so that the users can access expression sets and lookup tables.
- Decision MatricesA decision matrix matches input values to a table row and returns the row's output values. Expression sets and various digital procedures can call decision matrices. Decision matrices accept JSON input from, and return JSON output to the digital processes that call the matrices. Decision matrices are useful for implementing complex rules in a systematic, readable manner.
- Decision Tables for Business Rules EngineDecision tables are complex lookup tables that read business rules with multiple inputs, and return multiple outputs for records in your Salesforce org, or for the values that you specify. Define business rules and let decision tables decide the outcome.
- Expression SetsExpression sets—the calculation engine of business rules—consist of a series of steps connected in a logical flow built from variables, constants, conditions, calculations, lookups, and aggregations. Expression sets accept JSON input from and return JSON output to the digital processes that call the sets.
- Decision Explainer for Expression SetsUse Decision Explainer with Business Rules Engine to show your users explanations for the results of steps in an expression set, and to capture action logs for expression set runs. Store explanations for expression steps in explainability message templates. And then add the templates to your expression set steps for which you want to show explanations. When you simulate the expression set version, switch to the Concise view option to preview how your users see the explanations.
- Business Rules Engine IntegrationsExpression sets and lookup tables—the Business Rules Engine components—can be called from Flow and Omnistudio. You can also use Business Rules Engine Business APIs to call these components from workflows that are created by using third-party tools.
- Calculation Matrix and Procedure Migration to Business Rules EngineTo use calculation procedures and calculation matrices from OmniStudio as Business Rules Engine components, migrate these OmniStudio components as expression sets and decision matrices. To migrate a calculation procedure as an expression set, and a calculation matrix as a decision matrix, use the CalculationMatrixMigrationService and CalculationProcedureMigrationService Apex classes.
- Business Rules Engine Default LimitsReview the default limits for Business Rules Engine components and their usage. If your business requires any default limits to be raised, contact Salesforce Customer Support for further guidance.
Overview and Purpose of the API
The Salesforce Business Rules Engine API allows you to build powerful, scalable lookups and calculations to automate complex decisions. The rules created with the Business Rules Engine are easy to maintain and integrate directly with Flow, OmniStudio, and third-party workflow tools using connect APIs.
Authentication Requirements and Security Details
The API uses OAuth 2.0 Client Credentials OAuth Dance for authentication. To connect to Salesforce and get an access token, you need to pass the access token in requests to the Connect REST API.
OAuth 2.0 Client Credentials Dance
- Authorization Header:
Authorization: Bearer <access_token>
- Token Endpoint:
https://replacewithYourDomain/services/oauth2/token
- Grant Type:
client_credentials
Example Access Token Response
{
"access_token": "00D7Q000006Eymn!ARIAQHNaKq.cJHzvdEjidSy3dtC.dyOClvHaRa_beJ0Wx7kWXBKpyM3_vLQt5V1i4Fn75dQCiHsD0lhFHjNJjfAHCrO9V30Y",
"signature": "sN6qRXIPX7oSQrwXFLsA51VMduDSflqliCn8VDYY+r4=",
"scope": "cdp_ingest_api custom_permissions cdp_segment_api cdp_api content cdp_identityresolution_api interaction_api chatbot_api wave_api einstein_gpt_api cdp_calculated_insight_api id api eclair_api pardot_api lightning visualforce sfap_api cdp_query_api openid cdp_profile_api user_registration_api pwdless_login_api chatter_api forgot_password",
"instance_url": "https://composableforce-dev-ed.my.salesforce.com",
"id": "https://login.salesforce.com/id/00D7Q000006EymnUAC/0057Q000003EZDdQAO",
"token_type": "Bearer",
"issued_at": "1704283262172",
"api_instance_url": "https://api.salesforce.com"
}
Base URL and Environments
- Base URL:
https://{yourInstance}
- Example Instance:
composableforce-dev-ed.my.salesforce.com
Detailed Endpoint Documentation
1. Run Expression Set
Endpoint
- Method: POST
- Path:
/services/data/v{version}/actions/custom/runExpressionSet/{expressionSetAPIName}
URI Parameters
- version: The API version (e.g., "58.0", "59.0", "60.0").
- expressionSetAPIName: The unique API name of the expression set within your Salesforce instance.
Request Body
{
"inputs": [
{
// Vary depending on the selected expression set
}
]
}
Response
- 200 OK{"actionName": "myDecisionMatrixOrSet","isSuccess": true,"outputValues": {},"version": 1}
- 400 Bad Request
- 500 Internal Server Error
2. Run Decision Matrix
Endpoint
- Method: POST
- Path:
/services/data/v{version}/actions/custom/runDecisionMatrix/{UniqueName}
URI Parameters
- version: The API version (e.g., "58.0", "59.0", "60.0").
- UniqueName: The unique identifier of the record, sourced from the name of a decision matrix.
Request Body
{
"inputs": [
{
// Vary depending on the selected decision matrix
}
]
}
Response
- 200 OK{"actionName": "myDecisionMatrixOrSet","isSuccess": true,"outputValues": {},"version": 1}
- 400 Bad Request
- 500 Internal Server Error
3. Expression Set Invocation
Endpoint
- Method: POST
- Path:
/services/data/v{version}/connect/business-rules/expressionset/{expressionSetName}
URI Parameters
- version: The API version (e.g., "55.0").
- expressionSetName: The unique name of the expression set.
Request Body
{
"inputs": [
{
"age": "25",
"state": "CA",
"PatientId": "001xx000003GYjnAAG"
}
],
"options": {
"effectiveDate": "2022-12-03T10:15:30Z",
"useDatesOnly": "true"
}
}
Response
- 201 Created{"outputs": [{ "result": [], "error": "Input Data is Missing"},{ "result": [
]},{ "result": [], "error": "There is no output for the given input data"}]}{ "name": "premium", "value": "2400" }, { "name": "tax", "value": "300" }
- 400 Bad Request
- 500 Internal Server Error
4. Decision Matrix Lookup
Endpoint
- Method: POST
- Path:
/services/data/v{version}/connect/business-rules/decision-matrices/{matrixName}
URI Parameters
- version: The API version (e.g., "55.0").
- matrixName: The unique name of the decision matrix.
Request Body
{
"inputs": [
{
"input": [
{
"name": "premium",
"value": "2400"
}
]
}
],
"options": {
"effectiveDate": "2022-12-03T10:15:30Z"
}
}
Response
- 201 Created{"outputs": [{ "result": [], "error": "Input Data is Missing"},{ "result": [
]},{ "result": [], "error": "There is no output for the given input data"}]}{ "name": "premium", "value": "2400" }, { "name": "tax", "value": "300" }
- 400 Bad Request
- 500 Internal Server Error
Error Handling and Status Codes
- 200 OK: The request was successful.
- 201 Created: The resource was successfully created.
- 400 Bad Request: The request was invalid or cannot be served.
- 500 Internal Server Error: An error occurred on the server.
Best Practices for Implementation
- Ensure that your OAuth tokens are securely stored and not exposed in client-side code.
- Validate all input data before sending it to the API to avoid unnecessary errors.
- Handle all possible error responses gracefully in your application to provide a better user experience.
- Use the appropriate API version to ensure compatibility with your Salesforce instance.
Sample Code Snippets
Sample Request for Expression Set Invocation
POST /services/data/v59.0/connect/business-rules/expressionset/myExpressionSetName
{
"inputs": [
{
"age": "25",
"state": "CA",
"PatientId": "001xx000003GYjnAAG"
}
],
"options": {
"effectiveDate": "2022-12-03T10:15:30Z",
"useDatesOnly": "true"
}
}
Sample Request for Decision Matrix Lookup
POST /services/data/v59.0/connect/business-rules/decision-matrices/myDecisionMatrix
{
"inputs": [
{
"input": [
{
"name": "premium",
"value": "2400"
}
]
}
],
"options": {
"effectiveDate": "2022-12-03T10:15:30Z"
}
}
For more detailed information, refer to the Salesforce Industries Common Resources Developer Guide.