Revenue Cloud project notebook, written by two Meir IT consultants who implement it.

What is Revenue Cloud?

Quote and Order·Admin

Generating the Quote Document from the Pricing Context

The pricing engine already reads the quote through a context definition. Pointing the Word template at that same definition removes the extraction layer, as long as every custom attribute is tagged.

Nathan Altmann · Revenue Cloud consultant at Meir IT

Published 3 min read

Admin path·6 of 12·Next: Why a Negative Amendment Came Out at Zero

In 3 linesfor leadership

  1. Quotes had to come out in the company's Word template, with customer, lines and totals.
  2. A separate copy of the quote data drifts away from the price, and nobody notices.
  3. The document reads the same data as pricing, so document and price stay in line.
In this article (6 sections)
  1. The problem
  2. The solution
  3. Setting it up
  4. The choice and its cost
  5. In practice
  6. Sources

The problem

Step: generating the quote document. A quote had to come out as a branded document, with the customer, the lines and the totals, in the company’s existing Word template. The pricing engine already read that quote through a context definition: the description of the quote data the pricing procedure uses.

The usual approach builds an extraction layer to feed the Word template. That is a second description of the same data, and it has to be maintained alongside every change to the quote model.

The solution

Two descriptions of the same quote drift apart. A field added for pricing goes into the context definition, because pricing would break without it. Nothing forces anyone to add it to the extract, so the document falls behind the quote, and nobody notices until a customer reads a document that doesn’t match the price.

Pointing the document template at the same context definition the pricing procedure uses removes the second description. The data contract already exists and is already maintained, because pricing depends on it. Tokens in the template are then simply the names of context attributes.

Setting it up

  1. Bind the template to the context instead of a custom extract.
  2. Name every token exactly like its attribute. Custom attributes keep their __c suffix in the token.
  3. Tag every attribute you plan to use. An attribute can only be used as a token if it carries a context tag. Inherited attributes are already tagged and work right away. Custom ones must be mapped, tagged and republished. That is why “only the inherited ones work” is the first symptom you will see.
  4. Format dates and resolve names before the template sees them. A raw date shows as an ISO timestamp, and the context exposes an account reference rather than the account name.

The choice and its cost

Using the pricing context has a price: document changes touch a definition pricing also depends on. Adding attributes is safe. Anything else deserves a sandbox first.

In exchange there is no second data layer to maintain, and the document and the price can’t disagree about what the quote contains.

An external document service makes sense at high volume, or when the document needs content Salesforce should not store. For a quote document, it adds a dependency for no gain.

In practice

  • Bind the template to the pricing context definition, not to a custom extract.
  • Tag and republish every custom attribute before using it as a token.
  • Check which total is net before putting it on the document.
  • Upload new versions of the template file, never a replacement file.

Sources

  1. ContextDefinition
  2. Quote
  3. Context Service Additional Information
A technical question about this article?

A question about this article? I reply within 48 hours.

Something unclear, a mistake, or different behavior in your Salesforce org? Write to me.

Prefer email? Write to nathan@meir-it.com

Get notified of new articles

Type at least two letters.