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

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 |FieldApiName|}}

    • 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 |FieldApiName| "DateFormat"}}

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

    • This helper requires 2 arguments. FieldApiName should be the field that you want to convert and format 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 |FieldApiName|}}

    • 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 |FieldApiName| [Precision]}}

    • 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 |GridApiName| |FieldApiName|}}

    • 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.

    • GridApiName represents the name of Grid set(with a table icon).

    • FieldApiName represents the field that you'd like to sum all from the selected Grid container in GridApiName.

    • 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 |FieldApiName1| |FieldApiName2|}}

    • 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.

    • FieldApiName1 and FieldApiName2 represent the fields 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 |GridApiName| |FieldApiName1| |FieldApiName2|}}

    • 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.

    • GridApiName represents the name of Grid set(with a table icon).

    • FieldApiName1 and FieldApiName2 represents the fields that you'd like to sum all from the selected Grid container in GridApiName. 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 |FieldApiName1| |FieldApiName2|}}

    • 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.

    • FieldApiName1 and FieldApiName2 represent the fields that you'd like to subtract. It’ll subtract the value of FieldApiName2 from FieldApiName1. 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 |GridApiName| |FieldApiName1| |FieldApiName2|}}

    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 FieldApiName1 and the value of FieldApiName2 for each entry in a grid. Then, sum up all these calculated differences.

    2. FieldApiName1 and FieldApiName2 represent 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 |FieldApiName| |(eq) or (ne)| "ComparisonValue" "ValueIfTrue" "ValueIfFalse"}} 
    • FieldApiName: 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 FieldApiName.  

    • 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
    {{#if |FieldApiName|}} "BodyIfTrue" {{else}} "BodyIfFalse" {{/if}} 
    • FieldApiName: 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 GridApiName}} 
    {{GridApiName-FieldApiName}} 
{{/each}}
  1. {{#each GridApiName}} ... {{/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.