Skip to main content
Skip table of contents

Display content with result from a calculation (Legacy)

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

image-20240109-094332.png

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

image-20240109-094342.png

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

image-20240109-094354.png

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

image-20240109-094400.png

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

image-20240109-094416.png

Click Add + to create a new Custom Data Formatter

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

image-20240109-094424.png

Give a name for the new Formatter, 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'

image-20240109-094437.png

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

image-20240109-094447.png

Continue with the Tax Amount

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

image-20240109-094454.png

The final table will look like

image-20240109-094459.png

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.