Skip to main content
Conga Support

Document scripting method statements

This article is maintained for legacy purposes only.  All clients should be utilizing the Modern Variables feature, which provides a modern, point-and-click interface for formatting variables.  If this feature is not enabled in your account, please contact Conga Global Support.

What

Conga Collaborate document scripting method statements allow you to format variables in a document. 

For an overview of document scripting, reference the Document scripting overview article.

Why

Being able to format your variables is important for the look, feel, and design of your document.  Document scripting allows you to, among other things, remove unnecessary decimal places, display links as images, and format currency variables with the proper currency symbols.

How

The following table summarizes supported method statements, their descriptions, and examples of how to use them.  To see more detailed explanations and examples for each, scroll down to it's corresponding detail section.

Document scripting requires entirely lower case variables, even if the variable would normally have capitalized letters.
Ex: { { Opportunity_Name } } would be { { opportunity_name } } when used with document scripting.

Method Description Example Result
as_img Takes a URL and displays the image
found at that URL
{{image_variable.as_img}}
where image_variable contains a URL for the image
Image displayed
as_iframe Takes a URL and displays the content found at that URL in an iframe { { url_variable.as_iframe } }
Where url_variable contains a URL for the content to display within the iframe
Content displayed within the document page
to_i Forces a number to display as an integer.
Always rounds down
{{number_variable.to_i}}
where number_variable = 1000.0
1000
to_f Forces a number to display as a float.  A single decimal place is added to the number. {{number_variable.to_f}}
where number_variable = 1000
1000.0
to_url Takes a string and turns it into a hyperlink { { url_variable.to_url } }
where url_variable = https://getconga.com
https://getconga.com
number_to_currency Displays numbers with currency formatting {{number_to_currency(number_variable)}}
where number_variable = 1000.32
$1,000.32
to_formatted_date Displays a date variable with the selected
formatting applied
 
{{date_variable.to_formatted_date("%-m/%-d/%Y")}}
where the date is May 5, 2018
5/5/2018
 
as_img

Using as_img tells Conga Collaborate to interpret and display the variable value (which must be a publically accessible image URL) as the image itself instead of the URL text.  CSS inline style modifiers can also be added to adjust height, width, etc.

 

Example

Result

{ { image_variable.as_img } }
where image_variable contains a URL for the image

Image displayed

{ { image_variable.as_img("style" => 'height: 30px; width: 30px;') } }

Image displayed with height and width of 30px

{ { image_variable.as_img("style" => 'width: 15%;') } }

Image displayed with width of 15%

 
as_iframe

Using as_iframe tells Conga Collaborate to pull the content located at the URL into an iframe within the document.  For example, you want to display a form within a Conga Collaborate page, so you pull it into the page using as_iframe.  CSS inline style modifiers can also be added to adjust height, width, etc.

Example Result
{ { url_variable.as_iframe } }
Where url_variable contains a URL for the content to display within the iframe
Content displayed within the document page
{ { url_variable.as_iframe("style" => 'height: 300px;') } } iframe height set at 300px
 
to_i

When using to_i, a number variable is displayed as an integer instead of a float. All decimal points are removed and the number always rounds down.

EXAMPLE Result
{ { number_variable.to_i } }

where number_variable = 1000.0
1000
{{number_variable.to_i}}
where number variable = 100.67
100


this statement makes Conga Collaborate interpret the string “23” as a number
23
 
number_to_currency

By default, Conga Collaborate displays CRM currency values as floats.  Using number_to_currency allows you to format these values using currency symbols. In addition to simply converting a number to a currency format, number_to_currency has several additional attributes.  These are described below:

EXAMPLE RESULT
format as currency
{{number_to_currency(number_variable)}}
where number_variable = 1000.32
$1,000.32
change the currency unit
{{number_to_currency(number_variable, :unit=>"&pound")}}
£1,000.32
change the delimiter
{{number_to_currency(number_variable, :delimiter=>".")}}
$1.000.32
change the currency unit and delimiter
{{number_to_currency(number_variable, :delimiter=>'.', :unit=>'¢')}}
¢1.000.32
change the number of decimal places
{{number_to_currency(number_variable, :precision=>1)}}
$1,000.3

Using an apostrophe as the delimiter

This is a special case because Ruby (the language that document scripting methods are based on) uses apostrophes as part of its own parsing process such that an apostrophe cannot be used without using an escape character.  In Ruby, the escape character is a backslash \ . The syntax looks like this:

EXAMPLE RESULT
{ { number_to_currency(number_variable, :delimiter=>"\'") } } $1'000.30

All number_to_currency attributes can be combined into one statement if desired

to_formatted_date

This method provides several options for formatting date variables.  Using a combination of m, d, y, A, and B, you can display the date in numbers or in words.

Using %-m or %-d will only display one digit as appropriate, while using %m or %d will always display two digits

EXAMPLE RESULT
{{date_variable.to_formatted_date("%-m/%-d/%Y") 7/7/2017
{{date_variable.to_formatted_date("%Y-%m-%d") 2017-07-07
{{date_variable.to_formatted_date("%A, %B %-d, %Y") Thursday, July 7, 2017

 

  • Was this article helpful?