taggalongRevenue Cloud field guide
Menu
Advanced · Lab

Watch a constraint fire, then add a message rule

Drafted, not yet confirmed · your lab org

You'll watch the launchpad's CML rules act on the QuantumBit Complete Solution, then add the warning from the CML page and see it in the configurator.

Your lab org comes with a sample company, QuantumBit. Its products, price books and billing setup are there because the labs use them, so leave them as they are. Everything a lab names starts with TGFG-, so you can always tell your work from QuantumBit's.

Before you start

To do this lab you need a lab org of your own, with this lab set up in it. This page lists what the lab needs, so you can set it up by hand. The lab kit does it for you. Start your own lab

Open your lab org with cci org browser my-lab, or from Org Launcher if you set it up. Track your orgs

You need a Revenue Cloud org built from Salesforce's launchpad, and a user who can edit constraint models, such as the launchpad's admin.

Loading the constraint models turns the Constraint Rules Engine on, which stops the configurator's Business Rules Engine rules. Use a second practice org: the other labs were written against the Business Rules Engine.

The setup makes these for you:

It makes Called What it's for
The launchpad's constraint models, if none are loaded QuantumBit Bundle, version QuantumBitBundle_V1 The model you change
An account in USD, with a contact TGFG-CML Lab Someone to quote

By hand: in the launchpad's cumulusci.yml, set constraints and constraints_data to true, run its prepare_constraints flow, set both back to false, and create the account. With both false, as the lab org page leaves them, the flow skips the steps that need them and still says it completed.

Done this lab before? Name the quote TGFG-CML Lab Quote 2. If the model still has your message line, don't add it again.

Every step of this lab has been clicked through on screen in a fresh lab org.

Steps

  1. Make the quote

    Quote

    Why The configurator works on a quote's lines, so the bundle needs a quote to sit on.

    Go to App Launcher then Quotes then New Quote

    Field Set it to Why
    Quote Name TGFG-CML Lab Quote Keeps it apart from QuantumBit's records.
    Account for Quote TGFG-CML Lab The account the setup made.
    Quote Currency Leave it at USD - U.S. Dollar The bundle's prices are in USD.
    Transaction Type Leave it at Advanced Configurator It's in the System Information section near the bottom of the form, and the constraint model runs in the Advanced Configurator.

    Save.

    You should see: a toast that says Quote "TGFG-CML Lab Quote" was created, and the quote open on its Quote Lines tab with Quote Line Items (0).

  2. Open the bundle in the configurator

    Quote

    Why The launchpad's active model carries two rules for the QuantumBit Complete Solution bundle, and they act in the configurator.

    Go to TGFG-CML Lab Quote then Browse Catalogs then Bundle then QuantumBit Complete Solution then Pricing Options then Configure

    If a Choose Price Book window opens, keep Standard Price Book and click Save.

    In the Browse Products window, click the Bundle category. On the QuantumBit Complete Solution card, click the small Pricing Options icon beside its price. The buying options list opens with USD 0 for TermDefined Annual chosen. Leave it and click Configure.

    Don't use the Add Product box on the quote for this bundle: it lists QuantumBit Complete Solution four times, once for each way it's sold, with nothing on screen to tell them apart.

    You should see: a window called Configure QuantumBit Complete Solution, with attribute tabs Operating System, Tech Specs and Utilization, and a Summary panel that lists Operating System Amazon Linux 2, Base Core Count 4 and Data Utilization 0.

  3. Let the engine set a value

    Quote Line Item

    Why A constraint keeps values consistent: the model says Red Hat needs 8 cores. Nobody set the core count, so the engine may change it to make the rule hold.

    Go to Configure QuantumBit Complete Solution then Operating System

    Choose Redhat Enterprise Linux. Then open the Tech Specs tab.

    You should see: Base Core Count 8 in the Summary panel at once, and on Tech Specs a Base Core Count list that offers only 8. If nothing changes, the quote may not be using the Advanced Configurator: check its Transaction Type.

  4. Overrule the engine

    Quote Line Item

    Why The engine never changes a value a user set. With both values set by you, the constraint can only fail, so it shows its message instead.

    Go to Configure QuantumBit Complete Solution then Tech Specs then Base Core Count

    While Red Hat is chosen you can't pick 4, so set the core count first.

    On Operating System, choose Amazon Linux 2: Base Core Count goes back to 4. On Tech Specs, click 2, then 4. Then on Operating System choose Redhat Enterprise Linux.

    Last, choose Amazon Linux 2 again.

    You should see: with Red Hat chosen, a bar at the top with Errors (1), Warnings (0) and Info (0), and under it "When running RedHat Linux, a minimum of 8 Base Cores is required!". Base Core Count stays 4 and Save & Exit is greyed out. Back on Amazon Linux 2, the bar goes away.

  5. Trigger the require rule

    Quote Line Item

    Why A require rule makes a product present: five or more QB API Management Solution adds Additional API.

    Go to Configure QuantumBit Complete Solution then Software then QB API Management Solution then Quantity

    The product's name is cut short on its row, as QB API Management So... Set its Quantity to 5 and press Tab.

    Then click Save & Exit, and Close the Browse Products window.

    You should see: the Additional API row ticked by itself with Quantity 1, and Additional API added under Software in the Summary panel. Back on the quote, Quote Line Items (6), with QuantumBit Complete Solution and its five components, Additional API among them.

  6. Add a message rule

    Expression Set

    Why A constraint model's CML is stored on its version. The launchpad switches a version off and on after uploading new CML so the configurator picks it up, and this step does the same.

    Go to App Launcher then Constraint Models then QuantumBit Bundle then QuantumBit Bundle V1 then CML Editor

    QuantumBit Bundle V1 is in the Constraint Model Versions list on the model's page. It opens Constraint Builder in a new browser tab, on the Visual Builder.

    Click Deactivate, then OK in "Deactivate constraint model?". The editor can't be changed while the version is active.

    Open the arrow beside Visual Builder and choose CML Editor. Scroll down to type QuantumBitCompleteSolution : LineItem. Near its end is the require line that doesn't start with //. Click at the end of that line, press Enter, and type or paste the line below.

    Click Save, then Activate.

    message(Data_Utilization >= 40, "At {} percent data utilization, plan database capacity before go-live.", Data_Utilization, "Warning");
    

    If the editor reports a syntax error, compare your line with the one above, character for character.

    You should see: "Constraint model deactivated." after Deactivate, an orange "Just a heads up..." note about unsaved changes once you type, "Constraint model saved." after Save, and after Activate a short "Activating..." and then the red Deactivate button again.

  7. See your message

    Quote Line Item

    Why A message rule only talks: it doesn't change any value, and each {} takes the next argument.

    Go to Quotes then TGFG-CML Lab Quote then QuantumBit Complete Solution then Configure

    Go back to the quote's browser tab. On the Quote Lines tab, open the arrow at the end of the QuantumBit Complete Solution row and choose Configure. Open the Utilization tab and set Data Utilization to 50. When the message bar appears, click Warnings (1). Then set Data Utilization to 30.

    You should see: at 50, a bar with Errors (0), Warnings (1) and Info (0); under Warnings (1), "At 50 percent data utilization, plan database capacity before go-live." with a warning triangle, and the same triangle beside Cancel. Save & Exit stays available. At 30 the bar is gone.

    Click Cancel, then OK in "Leave this page?".

  8. Take your rule out

    Expression Set

    Why While the line is in the model, everyone who configures the Complete Solution sees it.

    Go to App Launcher then Constraint Models then QuantumBit Bundle then QuantumBit Bundle V1 then CML Editor

    It opens another Constraint Builder tab. Click Deactivate and OK, switch to CML Editor, delete your message line, click Save, then Activate.

    Reopen the configurator on the quote (Quotes > TGFG-CML Lab Quote > the arrow on the QuantumBit Complete Solution row > Configure), open Utilization and set Data Utilization to 50. Then Cancel and OK.

    When you close the Constraint Builder tabs, your browser may ask whether to leave the page. Your changes are already saved, so you can leave.

    You should see: "Constraint model activated." after Activate, and in the configurator Data Utilization 50 with no message bar.

What to take away

A constraint makes values agree, a require adds products, and a message only talks. The engine never overrides what the user set. After a change to a model, the launchpad switches its version off and on so the configurator picks the change up, and this lab did the same.

The reasons come from Salesforce's documentation and the launchpad's files, listed on the CML page.

Back to Constraint Modeling Language (CML)