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
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:
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:
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:
To simplify more, results of other operators can be evaluated into a variable.
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.
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.
Operator Reference API
📄️ Array Operators
When we need to work with lists, these operators will help with your markdown.
📄️ Collection Operators
When we need to work with collections, these operators will help with your markdown.
📄️ Comparison Operators
When we need to compare values from one another, these operators will help with your markdown.
📄️ Date Operators
When we need to work with dates, these operators will help with your markdown.
📄️ Inflection Operators
When we need to work with inflection, these operators will help with your markdown.
📄️ Math Operators
Math operators describe mathematical formulas in markdown to dynamically calculate numerical values on the deal.
📄️ Number Operators
When we need to work with numbers, these operators will help with your markdown.
📄️ Object Operators
When we need to work with objects, these operators will help with your markdown.
📄️ Regular Expression Operators
When we need to work with regular expressions, these operators will help with your markdown.
📄️ String Operators
When we need to work with strings, these operators will help with your markdown.
📄️ URL Operators
When we need to work with urls, these operators will help with your markdown.
📄️ Utility Operators
Miscellaneous operators included with RevOps Templates.