Skip to main content

Operators

What is an {{ operator }}?

Operators are a simple templating language that allows you to dynamically display text based on conditional logic you define. With Operators, you may include legal language when someone wants to purchase the premium support package, display different term language based on the agreed upon marketing permission, or simply show a date or number in a different format.

Operators start with curly braces, {{ operatorName }} or can be used as blocks, {{#operatorName}} My Text {{/operatorName}}.

Operators can also contain positional arguments {{#eq "a" "a"}} a=a {{/eq}}.

They can be string interpolated values like the customer name {{deal.customer.legalName}} or blocks like an equality operator {{#eq "a" "a"}}Show the balloons!{{/eq}}.

Where to use Operators

Markdown Friendly Inputs support Operators >

Operators can be accessed in any Markdown-powered text field on a deal, such as the line item description and agreement term language field.

Examples

Here are some of the most use cases for operators.

Using {{ #eq }} to add text

{{#eq}} is an simple and common Operator because it simply means whenever the two arguments equal render the following text.

Perhaps you want to include a message to your customer, when they are renewing their agreement that is different than if they are purchasing your product for the first time. In that case, we'll use {{#eq}} to evaluate our agreement form type. When the form type is "renewal" we'll thank the customer for continuing to partner with us. And when the form type is a new order, we'll welcome them to our partnership.

In the text field of our term language, we'll simply include the following:

{{#eq deal.contract.formType "renewal"}}
Thank you for your continued business!
{{/eq}}
{{#eq deal.contract.formType "new-order"}}
We're excited to start this partnership!
{{/eq}}

Using {{ #eq }} with properties to display different text

The {{#eq}} operator will commonly be used in combination with custom term properties and SKU properties. Based on the custom properties we create and the values entered by our Sales Rep, specific agreement language will display.

In this example, we allow our Sales team use our Online Terms of Service or an attach Master Service Agreement (MSA). To give them this option, we'll create a custom property on our term and call it "Governing Terms" with two options "Online ToS" and "Attached MSA".

When "Online ToS" is selected, then the agreement language would references our online terms of service. However, if the Rep selects "Attached MSA", then the agreement language references the MSA which we'll attach to our deal.

The Operator for our term language would look like the following:

{{#eq current.term.properties.GoverningTerms.value "Online ToS"}}
This SaaS Services Agreement (“Agreement”) is entered into as of the
earlier of the Service Term start date or the date of the last signature
below (the “Effective Date”) between ResourcefulPanda, Inc with a place
of business at 445 Panda Lane, San Francisco, CA 94117 (“Company”), and
{{deal.customer.legalName}} (“Customer”). This Agreement includes and
incorporates the above Order Form in addition to the [ResourcefulPanda
Terms of Service](http://resourcefulpanda.com/tos) in effect as of the
Effective Date.
{{/eq}}

{{#eq current.term.properties.GoverningTerms.value "Attached MSA"}}
This SaaS Services Agreement (“Agreement”) is entered into as of the
earlier of the Service Term start date or the date of the last signature
below (the “Effective Date”) between ResourcefulPanda, Inc with a place
of business at 445 Panda Lane, San Francisco, CA 94117 (“Company”), and
{{deal.customer.legalName}} (“Customer”). This Agreement includes and
incorporates the attached Master Service Agreement which contains, among
other things, warranty disclaimers, liability limitations and use
limitations.
{{/eq}}

Assigning variables for code re-use

The {{assign}} operator allows us to assign values for reuse in other expressions.

To use variables assigned via {{assign}}, they will be available under the defined name. For example, for the assignment: {{assign "email" "myemail@example.com"}}, the value can be referenced by {{email}}.

If a variable is re-assigned a different value, the new value will be accessible under the same variable name.

To assign a string to a value:

{{assign "email" "myemail@example.com"}}

# Show value
{{email}}

To simplify more, results of other operators can be evaluated into a variable.

{{assign "mathExpression" (multiply 2 2)}}

# Results
{{mathExpression}}

Using {{ moment }} to calculate dates

The {{moment}} operator allows us to format the dates we use on the agreement. In this example, we want to display a date that is 3 months after our contract start date in the "MM/DD/YYYY" format.

{{moment deal.terms.ContractDate.value add="months" amount="3" format="MM/DD/YYYY"}} 

Using {{ #switch }} to add text based on the line item on the deal

If we want to display custom agreement language based on the type of agreement we're creating, we can use the switch operator.

{{#switch deal.contract.formType}}
{{#case "new-order"}}As a new customer, {{/case}}
{{#case "renewal"}}Customer agrees to {{/case}}
{{#case "expansion"}}{{/case}}
{{/switch}}

Operator Reference API