Loading
Business Rules Engine
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Expression Set Migration By Using Salesforce CLI

          Expression Set Migration By Using Salesforce CLI

          Use Salesforce CLI (SF CLI) to migrate the Business Rules Engine components - such as expression sets, decision matrices, decision tables, and their dependencies - from one org to another.

          Required Editions

          Available in: Lightning Experience
          Available in: Enterprise, Unlimited, and Developer Editions for clouds that have Business Rules Engine enabled
          Note
          Note Although SF CLI supports migrating complete expression sets and decision matrices, it doesn’t support migrating individual versions. To deploy a single expression set version, first retrieve it via a package.xml manifest file, and then deploy it using another tool apart from SF CLI. See Sample package.xml Manifest Files.

          Let's consider an insurance business rule implemented in an expression set with the API name, InsuranceES1. This expression set calls a decision table (InsuranceDT1), and a decision matrix (InsuranceDM1) to handle parts of the business logic. After you test the components in a scratch org, they’re ready to be migrated to the production org or the target org.

          Here are sample commands to query the object tables for the component API names from a scratch org named ScratchOrgQ1.

          sf data query --query "SELECT DeveloperName FROM ExpressionSetDefinition where MasterLabel = 'Expression Set for Insurance'"  --target-org ScratchOrgQ1
          sf data query --query "SELECT DeveloperName FROM DecisionMatrixDefinition where MasterLabel = 'Decision Matrix for Insurance'"  --target-org ScratchOrgQ1
          sf data query --query "SELECT DeveloperName FROM DecisionTable where SetupName = 'Decision Table for Insurance'"  --target-org ScratchOrgQ1

          Ensure that you’ve installed and configured your SF CLI and connected to your orgs as described in the Salesforce DX Developer Guide. To migrate the components, first retrieve them from the scratch org and then deploy them to the target org.

          Retrieve Components from Scratch Org

          To retrieve the metadata of the decision table, decision matrix, and expression set from the scratch org, run these commands:

          sf project retrieve start --metadata ExpressionSetDefinition:<Expression Set Entity API Name> --target-org <Scratch Org Name>

          sf project retrieve start --metadata DecisionMatrixDefinition:<Decision Matrix Entity API Name> --target-org <Scratch Org Name>

          sf project retrieve start --metadata DecisionTableDefinition:<Decision Table Entity API Name> --target-org <Scratch Org Name>

          For the latest version of the SF CLI commands listed here, see Salesforce CLI Command Reference.

          Here are the commands to retrieve the components for the insurance business rule example from the scratch org we considered:

          sf project retrieve start --metadata ExpressionSetDefinition:InsuranceES1 --target-org ScratchOrgQ1

          sf project retrieve start --metadata DecisionMatrixDefinition:InsuranceDM1 --target-org ScratchOrgQ1

          sf project retrieve start --metadata DecisionTableDefinition:InsuranceDT1 --target-org ScratchOrgQ1

          Folders InsuranceES1, InsuranceDM1, and InsuranceDT1 that contain the metadata.xml of the expression set, decision matrix and decision table respectively are created under the force-app/main/default path.

          Deploy Components to Target Org

          Deploy the dependent elements independently before you deploy the expression set version itself. Run these commands to deploy the metadata of the decision matrix and decision table to the target org.

          sf project deploy start --metadata DecisionTableDefinition:<Decision Table API Name> --target-org <Target Org Name>

          sf project deploy start --metadata DecisionMatrixDefinition:<Decision Matrix API Name> --target-org <Target Org Name>

          To deploy the expression set, run this command:

          sf project deploy start --metadata ExpressionSetDefinition:<Expression Set API Name> --target-org <Target Org Name>

          Here are the commands to deploy the components for the example we considered to a target org named TargetOrgQ1:

          sf project deploy start --metadata DecisionTableDefinition:InsuranceDT1 --target-org TargetOrgQ1

          sf project deploy start --metadata DecisionMatrixDefinition:InsuranceDM1 --target-org TargetOrgQ1

          sf project deploy start --metadata ExpressionSetDefinition:InsuranceES1 --target-org TargetOrgQ1

          After you run this command, you receive a response with the details of the deployment. Now the decision matrix, decision table, and expression set are deployed to the target org.

          Migrating a decision matrix or decision table deploys the metadata of the component and not the data. Import the data into the component after the migration is complete and then activate the component.

          • After you migrate a decision matrix without row data, open the decision matrix version in the target org, and then upload the row data by using the Upload CSV File option.
          • After you migrate the decision table without row data, refresh the decision table with the latest data in the object that it refers to.

          For more information on various migration scenarios and how to handle them, see Considerations for Migrating Expression Sets.

           
          Loading
          Salesforce Help | Article