Drafted, not yet confirmed · your lab org
You'll extend the standard Sales Transaction Context, add one quote line field to it, build a small pricing procedure on your extension that reads the field, and simulate it against a real quote to watch the field come back in the procedure's output, without changing anything QuantumBit prices with.
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, Revenue Cloud Foundations, with its QuantumBit sample catalog, and a user who can extend context definitions (Context Service Admin) and edit pricing procedures (Salesforce Pricing Design Time User). The launchpad's admin user already can.
The setup makes these for you:
| It makes | Called | What it's for |
|---|---|---|
| An account in USD, at 4300 Main Street, Philadelphia, PA 19127, US | TGFG-Platform Lab | The customer |
| A contact and a default billing profile | TGFG Platform Lab Contact, TGFG-Platform Lab Billing | An order won't activate without a billing address, a shipping address and a bill-to contact |
| One subscription, sold through quote, order and activation | QB API Management Solution (QB-API-MGMT), Term Annual, quantity 1, 12,000 USD a year on the Standard Price Book | Its quote, New Quote For TGFG-Platform Lab, is the one you simulate against |
| A report of two names still free | TGFG_PlatformLabContext and TGFG-Platform Lab Pricing Procedure, or the same with a number |
Names for the context definition and the pricing procedure you build |
Done this lab before? Run the setup again. It gives you a new quote's Id and number and the next free names, such as TGFG_PlatformLabContext2 and TGFG-Platform Lab Pricing Procedure 2 (the number can be higher if earlier runs made more procedures). Use those wherever a step gives the first ones. What you built last time stays, unused, and shows up beside the new: the Custom Definitions list cuts names short, so tell your new definition by its Status, and two quotes are called New Quote For TGFG-Platform Lab, so find yours by its number.
Why a procedure of your own: the procedure Revenue Settings names prices every quote in the org, and it reads RLM_SalesTransactionContext. A procedure on your extension that nothing selects can be built and simulated without touching a quote.
Every step of this lab has been clicked through on screen in a fresh lab org.
Steps
Look at the standard definition
SetupWhy A context definition describes the data a process needs. Standard definitions can't be modified, so you extend them.
Go to Setup then Quick Find then
Context Servicethen Context Definitions then Standard DefinitionsSetup opens in a new browser tab. Names in the list are cut short:
SalesTransactionContextis the row whose Developer Name startsSalesTransactionCo, near the bottom (not OMSSalesTransactionContext). Open its row menu, the arrow at the end of the row. Don't pick anything yet. Then click its name.You should see: Extend and Clone in the row menu, Status Active. On its page, Developer Name
SalesTransactionContext__stdctx, and the Sync, Generate Apex Class, Edit and Deactivate buttons all greyed out.Read the launchpad's extension
SetupWhy QuantumBit prices with this extension today. You'll compare your own extension with it.
Go to Context Definitions then Custom Definitions then
RLM_SalesTransactionContextRead its Details tab and Map Data tab. Then, on its Structure tab, select the
SalesTransactionItemnode underSalesTransaction. Don't click Edit, Sync or Deactivate.You should see: Inherited From
SalesTransactionContext__stdctx, and Status Active. Map Data shows Mappings (14), with the Default column ticked only forQuoteEntitiesMapping. The Nodes tree has three trees (Asset,SalesTransactionand Contract), andSalesTransactionItemhas more than 150 attributes. A few end in __c, such asRLM_Distributor_Unit_Price__candRLM_Partner_Net_Total_Price__c.Extend the standard definition
SetupWhy Salesforce's help says to extend a context definition rather than clone it: an extension keeps the mandatory mappings, and Sync upgrades it when the parent changes.
Go to Context Definitions then Standard Definitions then
SalesTransactionContextrow menu then ExtendField Set it to Why Name TGFG_PlatformLabContextThe free name the setup gave you. Second time through, use the one with a number, such as TGFG_PlatformLabContext2.Click Save once. The window closes and the extension is built in the background, which takes about five minutes. Don't click Extend again while you wait: a second try fails because the name is taken. A name that's already taken is refused at once with "Failed to extend Context Definition, Definition Name or Developer Name with value ... already exist." When the success message has shown, click Context Definitions in the Setup tree and open the Custom Definitions tab.
You should see: a message "Context Definition Extension initiated. This operation might take some time to complete", then, a few minutes later, "Context Definition was extended successfully". Your definition is on the Custom Definitions tab, Status Inactive (the list cuts names short; done before, yours is the TGFG row that's Inactive). Its Details tab shows Inherited From
SalesTransactionContext__stdctx.Compare the two
SetupWhy An extension inherits the standard definition and nothing else. This shows what came along.
Go to Context Definitions then Custom Definitions then
TGFG_PlatformLabContextCompare its Structure and Map Data tabs with the launchpad's.
You should see: the same 14 mappings and the same three trees, but fewer attributes on
SalesTransactionItem, none ending in __c. The launchpad's own belong to its extension, not to the standard definition. None of the mappings has Default ticked yet.Add an attribute
SetupWhy A node maps to an object, and an attribute maps to one of its fields.
Go to Your definition then Edit then Next then Next then
SalesTransactionItemthen Add AttributesThe Structure tab only shows the structure; you change it in the Edit window. Edit opens four pages: Edit Context Definition, Edit Structure, Edit Attributes and Edit Attribute Tags. On Edit Attributes, pick
SalesTransactionItemin the Nodes tree (underSalesTransaction) and click Add Attributes. A blank row appears at the top of the list.Field Set it to Why Name TGFGLineNumber__cAttributes you add to an extension end in __c, like the launchpad's. Type INPUT Line Item Number is read-only, so the value only loads into the context. A field pricing writes back would be INPUT OUTPUT. Data Type STRING Line Item Number is a text value. Leave Transient unticked and Keep Localization as it is. Click Next, and don't close the window.
You should see: the Edit Attribute Tags page, the last of the four.
Tag it
SetupWhy A pricing procedure reads context data through tags, and writes its results back to the definition its tags belong to. A tag can't share its name with a decision table's label or API name.
Go to Edit Attribute Tags then
SalesTransactionItemthenTGFGthen + Add TagsPick
SalesTransactionItemin the Nodes tree and typeTGFGin the search box to find your attribute. Click + Add Tags on its row, typeTGFGLineNumber__cin Add Tag Name, and click Done. Then click Save.You should see: "Context Definition "
TGFG_PlatformLabContext" was updated." On the Context Tags tab,SalesTransactionItemfiltered byTGFGshowsTGFGLineNumber__cwith the tagTGFGLineNumber__c. On the Structure tab it is the last attribute ofSalesTransactionItem, INPUT and STRING.Map it to the quote line
SetupWhy A mapping loads the data at run time. Neither the standard definition nor the launchpad's extension maps the quote line's Line Item Number, so it's a real field you can add without creating one.
Go to Your definition then Map Data then
QuoteEntitiesMappingrow menu then Edit SObject Mapping then MapIn the Edit Mapping window, tick Mark as Default, then click Map. The Context Mapping page opens in a new browser tab. Select
SalesTransactionItemin the Node tree (its object isQuoteLineItem), typeTGFGin the search box, and open Select Fields on your attribute's row. Under Quote Line Item, pickLineNumber(the API name of Line Item Number), click Save under the list, then click Save at the top right. Close that tab and reload the Setup tab.You should see: "Context Mapping was saved.", and
TGFGLineNumber__cmapped toLineNumber. After the reload, Map Data shows Default ticked forQuoteEntitiesMappingand one more mapped attribute than before. For orders, a field would also need a mapping inOrderEntitiesMapping.Check the default and activate
SetupWhy
RLM_SalesTransactionContextmarksQuoteEntitiesMappingas its default mapping, and your extension should make the same choice. Salesforce's help ends an extension by activating it.Go to Your definition then Activate
Check that
QuoteEntitiesMappinghas Default ticked on Map Data, then click Activate at the top of your definition.You should see: Status Active on the Details tab, and a Deactivate button where Activate was. Without a default mapping it won't activate: the screen says "Cannot activate a definition without default mapping." Activating it leaves your quote as it was; the last step checks that.
See what prices quotes
SetupWhy Salesforce's help says the procedure selected here prices quotes and orders. Product Discovery Settings and Salesforce Pricing Setup select their own, for browsing and headless calls.
Go to Setup then Quick Find then
Revenue Settingsthen Revenue SettingsScroll to Set Up Salesforce Pricing. Look, but don't change anything.
You should see: "Select the default pricing procedure for this org." with RLM Revenue Management Default Pricing Procedure selected.
Open the default procedure
Expression SetWhy Every pricing procedure is an expression set, and each is tied to one context definition. This is the procedure Revenue Settings names.
Go to App Launcher then
Price Managementthen Pricing Procedures then RLM Revenue Management Default Pricing ProcedurePricing Procedures is a tile on the Price Management Home page. Don't click Edit, Delete or Clone.
You should see: Context Definition
RLM_SalesTransactionContext, Usage Type Pricing, Usage Subtype Revenue Cloud, and one version under Pricing Procedure Versions, also named RLM Revenue Management Default Pricing Procedure, with Active ticked.Read its elements
Expression SetWhy A procedure runs its elements in order, and Include in Output decides which elements' variables come back in its response. At least one element must have it.
Go to RLM Revenue Management Default Pricing Procedure then Pricing Procedure Versions then RLM Revenue Management Default Pricing Procedure
The version opens in the pricing procedure builder, in a new browser tab. Include in Output isn't on the cards: click a card, then open Element Details, the fourth icon down the left edge. Don't click Save, Deactivate or Activate, and don't use a card's menu (it offers Duplicate and Delete).
You should see: a long list of elements, starting with Map context tags to common pricing variables, with Assign the
EffectiveFromdate toPricingDatea few steps down. Most of the rest sit in purple List Container and group boxes that filter lines and price them. Include in Output is unticked on Get base prices from price book and ticked on elements inside groups, such as Calculate prorated price for term-defined lines.Create a procedure on your extension
Expression SetWhy Salesforce's help says a new pricing procedure starts as a blank version, tied to the context definition you pick. Yours takes your extension, so it can read your tag.
Go to App Launcher then
Price Managementthen Pricing Procedures then NewField Set it to Why Name TGFG-Platform Lab Pricing ProcedureThe free name the setup gave you. Second time through, use the one with a number, such as TGFG-Platform Lab Pricing Procedure 2.API Name TGFG_Platform_Lab_Pricing_ProcedureIt fills in from the name when you press Tab; check it matches. Second time through, it ends with the same number, such as TGFG_Platform_Lab_Pricing_Procedure_2.Usage Type Pricing It makes this a pricing procedure. Usage Subtype Revenue Cloud It appears once you pick Pricing, already set. Context Definition TGFG_PlatformLabContextThe procedure reads your extension's tags instead of RLM_SalesTransactionContext's. It's at the bottom of the list.Leave Initialize resources with default values as it is: it's greyed out. Click Save.
Don't copy the default procedure instead, with Save As or Clone. When this lab was checked in a launchpad org, simulating a copy on the extension stopped with "Invalid tag attribute name key:
RelatedChangeIdentifier__std", and Clone saved the copy's version already active.You should see: your procedure's page, with Context Definition
TGFG_PlatformLabContextand one version under Pricing Procedure Versions, TGFG-Platform Lab Pricing Procedure V1, with Active unticked and today as its Start Date Time.Start with a Pricing Setting
Expression SetWhy Salesforce's help starts each example procedure with a Pricing Setting element. It maps the line item and, by default, standard variables such as Net Unit Price and Subtotal.
Go to Pricing Procedure Versions then TGFG-Platform Lab Pricing Procedure V1 then + then
Pricingthen Pricing SettingThe version opens in the builder in a new browser tab, on an empty canvas that says Add step elements. Click the + under it, type
Pricingin Add Element and pick Pricing Setting. The new card is closed: open it with the arrow at its left edge, click Generate Context Tags, then open Input Variables.You should see: "The tag values have been updated. Verify your tag values and then, save your procedure." Input Variables (4) maps Line Item to
LineItem, Currency toCurrencyIsoCode, Is Derived toDerivedPricingAttributeand Contract Id to Contract.Make the procedure read your tag
Expression SetWhy An Assignment element copies a value from one tag into another, using what earlier elements produced and without touching the database. It's the first element to read your tag.
Go to The builder then + below Pricing Setting then Assignment
Point at the line below the Pricing Setting card and click the + that appears. In Add Element, pick Assignment. Open the new card and its Assignment variables section for the variables. Name and Include in Output are in Element Details, the fourth icon down the left edge, for the card you last clicked.
Field Set it to Why Name TGFG Copy Line NumberThe name the element shows in the builder. Include in Output Ticked Puts this element's variables in the procedure's response. Input Variable TGFGLineNumber__cYour tag, the value to copy. Type TGFGand pick it under Contexts.Output Variable ItemDescriptionA tag mapped to the quote line's Line Item Description, so the copy shows in the output. Type ItemDescriptionand pick it under Contexts.Click Save, but don't click Activate. It takes about 15 seconds.
You should see: two cards, Pricing Setting and TGFG Copy Line Number, with Save greyed out again and Simulate and Activate ready. If you save before the Pricing Setting is there, the builder refuses: "Add Pricing Settings as the first element in the pricing procedure."
Find your tag
Expression SetWhy Salesforce's help says a procedure runs with the tags of its context definition. This shows which procedure can see yours.
Go to Your procedure's builder then Resource Manager
Resource Manager is the second icon down the left edge. Type
TGFGLineNumberin its search box and openSalesTransaction. Then do the same search in the original procedure's builder (from its record, as in Read its elements), and close that tab without saving.You should see: in your procedure, Variables (1) and
SalesTransaction(1), with Context DefinitionTGFG_PlatformLabContextandTGFGLineNumber__clisted. In the original, Variables (0).Simulate against the quote
Expression SetWhy The simulator tests a procedure before anything is activated. Auto-fill line items loads the input from a real record, but only for tags with an sObject mapping and a value on that record.
Go to Your procedure's builder then Simulate
On Simulation Details, Context Definition shows
TGFG_PlatformLabContextand Context MappingQuoteEntitiesMapping. Tick Auto-fill line items, enter the quote Id the setup gave you in Object ID, and press Tab.You should see: the input filled from the quote.
SalesTransaction0 showsCurrencyIsoCodeUSD and an empty Contract.SalesTransactionItem0 shows an emptyDerivedPricingAttribute,LineItemholding your quote line's Id, andTGFGLineNumber__cholding your quote line's Line Item Number: the mapping alone loads it. Only the tags your two elements use are listed.Run it
Expression SetWhy Include in Output puts an element's variables in the procedure's response. Seeing your value there shows the whole chain works, from the quote line field to the procedure's output.
Go to Simulation Details then Simulate then Output then JSON Details
Click Simulate. The Output tab opens. Open JSON Details and scroll the JSON Output to simulationResults near its end.
You should see: no error. The right side of the screen stays empty: there's no waterfall view. In the JSON Output, under simulationResults, the
SalesTransactionItemholdsTGFGLineNumber__candItemDescriptionwith the same value, your quote line's Line Item Number. Higher up, pricingWaterfall lists one step, TGFG Copy Line Number, anAssignmentElement, with that value as its input and its output.Check nothing changed
QuoteWhy The procedure selected in Revenue Settings prices quotes. Yours is neither active nor selected, so the quote should be as it was.
Go to App Launcher then
Quotesthen New Quote For TGFG-Platform LabClose the builder's browser tab without activating your procedure. Look at Revenue Settings again, then open the quote. Done this lab before? Two quotes have that name: type the quote number the setup gave you in the list's Search this list box and press Enter. On the quote, open the line's own page with the arrow at the end of its row, then View.
You should see: Revenue Settings still names RLM Revenue Management Default Pricing Procedure. The quote is unchanged: Draft, Grand Total USD 12,000.00, and its line shows Sales Price and Net Unit Price USD 12000. On the line's page, Line Item Description is still empty.
What to take away
Standard context definitions are locked, so you extend them. The extension inherits the standard parts, stays upgradable through Sync, and holds only what you add.
A field reaches pricing through four things: an attribute on the right node, a tag, a mapping that loads it from the record, and an element that reads the tag. Without the first three the value never arrives; without the element nothing uses it.
A pricing procedure is tied to one context definition, so a new field means a procedure linked to the extension that carries it, tested in the simulator before anything is selected in Revenue Settings. Here that procedure is a small one that only reads the field. When this lab was checked in a launchpad org, a full copy of the default procedure on the extension stopped in the simulator with an error.
The reasons in each step come from Salesforce's documentation and from what we checked in a Revenue Cloud org. The guide page lists the sources: Platform.