Menu

Display content with result from a calculation

With Documill Dynamo, you can perform a calculation, using simple expression language to result different data which is not available from your Salesforce. This article instruct how to create a field with calculation in a template.

Example: Display quote amount with taxation

You can print the total from an opportunity by simply drag and drop the Amount field from Salesforce to template. Quite often, quote or invoice documents require to have the amount exclude taxation and the tax amount in the product table. What to do if your Salesforce does not have those fields setup?

Create a placeholder

In the template, add extra row to the table and add content to the row as the placeholder text

Select the <totalExcl> placeholder text

Click the span icon to Insert Span from the Editing toolbar

Add dynamic content to the span

On the right pane, select Tag tab -> Attributes

In Content, type in the calculation for the Amount before tax.

In this example, the tax is 10%, so we know the Amount before tax would be 90% of the total Opportunity Amount. Thus the value in Content will be Opportunity.Amount*0.9

Click Test to see the result with real data from test record

As you can see, the Quote (excl Tax) has the correct value now, but not the currency format as Total Price or Quote Total. Follow next steps to edit the currency format the the Quote.

Create and apply Custom Data Formatter

This step is optional. The result from a calculation will have Number as datatype. Follow this step when:

  • You want the resulted value have different Number format than the Number in Default Data Formatter
  • You want the value in Currency or Percentage format.

Go to Settings -> Salesforce Data

Scroll down to the Data Formatter -> Custom Data Formatter

Click Add + to create a new Custom Data Formatter

Select the formatter that you want to use. In this example, select Currency

Give a name for the new Fomatter, for example "amountFormat"

If you haven't change any thing from the Currency in Default Data Formatter and would like the new value has the same format with the rest of the document, you can leave the other attributes empty. Otherwise, edit the Locale, Pattern, Currency Symbol, Separators as you desire. See more Format number, currency or percentage

Go to the Document Template, click to <totalExcl> to select the span

In the Content Format, type the name of the new Formatter inside the single quotation 'amountFormat'

Now the new value will have the same currency format with the rest of the table.

Continue with the Tax Amount

Repeat the process to the <taxAmount>. The calculation for <taxAmount> will be Opportunity.Amount*0.1

The final table will look like

Comments

0 comments