Skip to main content
Skip table of contents

Template Helpers

What are Helpers

Helpers are convenient functions designed to help you personalize your template or format data retrieved from individual Bookmarks.

When added to the editor, the bookmarks have the following format:

CODE
{{#HelperName … }}             

Access Helpers

The helpers can be accessed from the bookmarks panel located next to the template content editor. You can access this panel when creating or editing a template.

For details about creating or editing templates, see this article: Templates: Managing Templates.

Helper Types

When using quotes within helpers, ensure that you use straight quotes (" ") that are plain vertical marks, instead of smart quotes (“ ”) that are plain vertical marks.

General Utilities

  1. Current Date/Time {{#now ["Date/Time format"]}}

    • You can add the current date/time generating the result through this helper. Noted, double quotes must be added.

    • If you don’t provide format, it follows the default format set in eBECAS/EDMISS.

    • For more details of formatting, visit here.

    • Example
      {{#now "dd MMMM yyyy"}} → 13 July 2023
      {{#now "MM/dd/yyyy"}} → 13/07/2023

  2. Yes/No {{#yesno ReplaceWithFieldApiName}}

    • Fields of type checkbox return the values as True or False. Using this helper you can convert these values into more friendly values: Yes and No.

    • If the value is True, it will be converted to Yes.

    • If the value is False, it will be converted to No.

    • If the value is not True/False but another type of data value such as simple text or number, it will be converted to No for output.

    • Example
      {{students-os_student}}, {{#yesno students-os_student}} → True, Yes
      {{students-online_student}}, {{#yesno online_student}} → False, No
      {{students-first_name}}, {{#yesno students-first_name}} → Ryan, No
      {{students-age}}, {{#yesno students-age}} → 24, No
      {{#date students-dob "dd/MM/yyyy"}}, {{#yesno students-dob}} → 03/01/2000, No

Format

  1. Date {{#date ReplaceWithFieldApiName "ReplaceWithDateFormat"}}

    • You can convert the format of Date through this helper.

    • This helper requires 2 arguments. ReplaceWithFieldApiName should be the field API name that you want to convert and ReplaceWithDateFormat is the same as Current Date/Time but it doesn’t support Time format.

    • For more details of formatting, visit here.

    • Example
      {{#date offer_courses-start_date "dd MMMM yyyy"}} → 13 July 2023
      {{#date offer_courses-start_date "dd/MM/yyyy"}} → 13/07/2023

  2. Currency {{#currency ReplaceWithFieldApiName}}

    • You can add the currency unit through this helper. It follows your regional format where you’re located.

    • Format can be various depending on your location/country.

    • Example
      {{offer-course_amount}} → 20000
      {{#currency offers-course_amount}} → $ 20000

    Most of currency fields in eBECAS/EDMISS is already combined with this helper. Use this helper if you need to add new field with currency.

  3. Percent {{#percent ReplaceWithFieldApiName ReplaceWithPrecision}}

    • You can add percentage unit and decimal places through this helper displaying the value of a field as percentage by adding the % symbol.

    • Precision represents a number how many decimal places you intend to display. If you don’t provide it, it’ll follow the default value same as the format in your database.

    • Example - A course with 50% discounted.
      {{offer_courses-discount_percent}} → 50
      {{#percent offer_courses-discount_percent}} → 50.00 %
      {{#percent offer_courses-discount_percent 0}} → 50 %
      {{#percent offer_courses-discount_percent 4}} → 50.0000 %

Formula

As Grid type template is about multiple values you need to show repeatedly, Sum currency helper shouldn't be placed in the grid template.

  1. Sum Currency (grid-field) {{#sumcurrency ReplaceWithGridApiName ReplaceWithFieldApiName}}

    • You can sum all the values of a single field in a grid and display the result as currency. This is very useful when you want to show total prices for offers or items.

    • Replace ReplaceWithGridApiName to the grid API name of Grid set(with a table icon).

    • Replace ReplaceWithFieldApiName to the field API name that you'd like to sum all from the selected Grid container in ReplaceWithGridApiName.

    • Example - An offer with ‘item1 $10’, ‘item2 $15’ and ‘item3 $18’
      {{#sumcurrency offer_items offer_items-total_amount}} → $33 (=$10 + $15 + $18)

  2. Sum Currency (single fields) {{#addcurrency ReplaceWithFieldApiName1 ReplaceWithFieldApiName2}}

    • You can add the value of FieldApiName1 to the value of FieldApiName2 and formats the result as currency. This is much helpful when you need to simply add two currency fields.

    • Replace ReplaceWithFieldApiName1 and ReplaceWithFieldApiName2 to the field API names that you'd like to add together. These fields must not be grid-fields.

    • Example - Course Amount is $100 and Agent Commission is $30.
      {{#addcurrency offers-course_amount offers-commission_amount}} → $130 (=$100 + $30)

  3. Sum Currency (grid-fields) {{#sumaddcurrency ReplaceWithGridApiName ReplaceWithFieldApiName1 ReplaceWithFieldApiName2}}

    • You can sum all the values of FieldApiName1 and FieldApiName2 in a grid and formats the result as currency. This is much helpful to display the total sum values for 2 different fields.

    • Replace ReplaceWithGridApiName to the name of Grid set(with a table icon).

    • Replace ReplaceWithFieldApiName1 and ReplaceWithFieldApiName2 to the fields that you'd like to sum all from the selected Grid container in ReplaceWithGridApiName. Both fields must be grid-fields.

    • Example - An offer with ‘Course1 $100 with Commission $20', ‘Course2 $150 with Commission $30' and ‘Course3 $80 with Commission $10'.
      {{#sumaddcurrency offer_courses offer_courses-amount offer_courses-commission_amount}} → $390 (=$100 + $20 + $150 + $30 + $80 + $10)

  4. Subtract Currency (single fields) {{#subtractcurrency ReplaceWithFieldApiName1 ReplaceWithFieldApiName2}}

    • You can subtract the value of FieldApiName2 from the value of FieldApiName1 and format the result as currency. It’s useful to display differences between 2 currency fields.

    • Replace ReplaceWithFieldApiName1 and ReplaceWithFieldApiName2 to the fields that you'd like to subtract. It’ll subtract the value of ReplaceWithFieldApiName2 from ReplaceWithFieldApiName1. These fields must not be grid-fields.

    • Example - Course Amount is $100 and Agent Commission is $30.
      {{#subtractcurrency offers-course_amount offers-commission_amount}} → $70 (=$100 - $30)

  5. Subtract currency (grid-fields) {{#sumsubtractcurrency ReplaceWithGridApiName ReplaceWithFieldApiName1 ReplaceWithFieldApiName2}}

    1. You can subtract the sum of FieldApiName2 from the sum FieldApiName1 in a grid and formats the result as currency. This means it calculates the difference between the value of ReplaceWithFieldApiName1 and the value of ReplaceWithFieldApiName2 for each entry in a grid. Then, sum up all these calculated differences.

    2. Replace ReplaceWithFieldApiName1 and ReplaceWithFieldApiName2 to the fields that you'd like to subtract from the selected Grid container in GridApiName. Both fields must be grid-fields.

    3. Example - An offer with ‘Course1 $100 with Commission $20', ‘Course2 $150 with Commission $30' and ‘Course3 $80 with Commission $10'.
      {{#sumsubtractcurrency offer_courses offer_courses-amount offer_courses-commission_amount}} → $270 (= ($100 + $150 + $80) - ($20 + $30 + $10))

Document Utilities

Document Utilities are used for document management, such as document page break and page numbering.

  1. Page Break {{{#pagebreak}}}

    • Insert it to break a page by force on a document.

    • Unlike other helpers, It must be placed in the triple curly brackets.

  2. Page Number {{#pagenumber}}

    • It displays the current page number on a document.

  3. Total Page Number {{#numpages}}

    • It displays the total page number on a document.

Conditional

Conditional helpers are used to display different values or content based on specific conditions.

  1. Conditional Bookmark
    It evaluates a specified field's value against a given comparison value to determine which value to display based on the condition.

    CODE
    {{#ifcond ReplaceWithFieldApiName (eq or ne) "ComparisonValue" "ValueIfTrue" "ValueIfFalse"}} 
    • ReplaceWithFieldApiName : Field used for comparison.  

    • (eq or ne): Comparison operator, where (eq) stands for "equal" and (ne) stands for "not equal".  

    • ComparisonValue: The value being compared with ReplaceWithFieldApiName.  

    • ValueIfTrue: The value to display if the condition is true.

    • ValueIfFalse: The value to display if the condition is false.

  2. Conditional Block
    It allows you to render content conditionally based on a specified field’s value.

    CODE
    {{#checkif ReplaceWithFieldApiName}} "BodyIfTrue" {{else}} "BodyIfFalse" {{/checkif}} 
    • ReplaceWithFieldApiName: This is the name of the field whose value will determine which block of content to display. If the field contains any value, except false, 0 or "" (empty value), the content inside "BodyIfTrue" will be displayed.

    • {{else}} "BodyIfFalse":This is an optional part of the conditional statement that defines the block of content to be displayed when the condition is false. If the field’s value is empty or contains a value such as false or 0 which makes the condition false, the content inside "BodyIfFalse" will be displayed.

Grid Utilities

The following utilities streamline the management of datasets containing multiple records.

  1. Grid Wrapper

This utility allows to iterate through a series of records that belong to an Object. For example, if you want to iterate and insert all the Contacts (records) for a Student.

Let’s explore the syntax:

CODE
{{#each ReplaceWithGridApiName}} 
    {{GridApiName-FieldApiName}} 
{{/each}}
  1. {{#each ReplaceWithGridApiName}} ... {{/each}}: These tags wrap the content that you want iterate through.

  2. GridApiName: This is the API name of the object that you want to iterate through. This object must be a Grid Item.

  3. FieldApiName: This is the API name of the field that will be inserted. This field must belong to the GridApiName defined in the {{#each}} tag.

Let’s see some examples:

Example 1: Insert all the contacts related to a student
Input

CODE
    Hi, Student!
    We're sending this email to confirm your emergency contacts.
    
    {{#each student_contacts}}
    Name : {{student_contacts-name}}
    Mobile : {{student_contacts-mobile}}
    {{/each}}
    
    Please let us know, if there's anything incorrect.                

Output
The output will have a list of all the contacts related to the student.

CODE
Hi, Student!
We’re sending this email to confirm your emergency contact.

Name : Jone Doe
Mobile : 0412123456

Name : Jane Doe
Mobile : 0498987654

Please let us know, if there’s anything incorrect.

Example 2: This is the same as the previous example but with some HTML code
Input

CODE
          
  <div>
    <p>Hi, Student!</p>
    <p>We're sending this email to confirm your emergency contact.</p>
    <table>
      <thead>
        <tr>
          <td>Name</td>
          <td>Mobile</td>
        </tr>
      </thead>
      <tbody>
        {{#each student_contacts}}
        <tr>
          <td>{{student_contacts-name}}</td>
          <td>{{student_contacts-mobile}}</td>
        </tr>
        {{/each}}
      </tbody>
    </table>
    <p>Please let us know if there's anything incorrect.</p>
  </div>
        

Output

Hi, Student!

We’re sending this email to confirm your emergency contact.

Name

Mobile

John Doe

0412123456

Jane Doe

0498987654

Please let us know, if there's anything incorrect.

JavaScript errors detected

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

If this problem persists, please contact our support.