ComUnity Platform
25.x
25.x
  • ComUnity Technical Overview
  • Getting Started
    • ComUnity Developer Toolkit
      • Login
      • Manage your account: Profile, Settings, and Actions
    • Manage your project
      • Create a project
      • Project Settings
      • General
      • Build and launch your project
      • Templates
      • App Users & Roles
      • Themes
      • Versions
      • Icon Management
      • Store URLs
      • Deploy
        • Environments
        • Manual Project Deployment Across Environments
        • Configuration
    • Organisations
      • Roles and Permissions
      • Organisational Management
      • Teams
  • Toolkit Guides
    • Data
      • Customising the Data Model
      • Manage Entities in the Data Model: Step-by-Step Guide
      • Setting Up Role-Based Permissions for Entities: Access Control Configuration
      • Creating Entity Associations: Configuring Table Links
      • Manage Inheritance in the Data Model: Configuring Entity Hierarchy and Inheritance
    • Screens
      • Integrated Navigation and UI Builder for Screens in the ComUnity Developer Toolkit
      • Building Screens
        • Screen Controls
        • Navigation
          • Lists in Navigation pages
            • Dynamic List Rendering in Navigation pages
            • Adding Sub-Screens to Navigation pages Using List Navigation
          • Page Link
        • Form
          • Screen Controls
          • Lists in Form pages
            • Static Item - List Item
            • Single Item - List Item
            • Entity Items - List Item
    • Custom Classes
    • Custom Website
      • Bindings
      • Pages
        • Page Development
        • Page Elements
        • Templates
        • Resources
    • Communications
      • Configuring Dynamic Action Templates for Event-Driven Communication Channels
        • Event Details: Understanding Data Sources for Dynamic Template Building
        • Email
        • SMS & WhatsApp
        • INAPP
        • Push Notifications
        • HTTP
      • Triggering the Communication Service
      • Communication Settings
    • Events and Notifications Management
    • Observability
      • Client Analytics
      • Metrics
      • Traces
    • Third Party Services
      • Azure Function Apps
      • Azure Logic Apps
      • Integrations
      • Microsoft Fabric
      • APIs
    • Services
      • Media Server
  • General Information
    • Debugging and editing your application code
  • Toolkit Tutorials
    • Build a Simple Blog App: The Beginner's Guide to ComUnity Development
    • Building a Comprehensive News App: Integrating In-App Messaging, Push Notifications, SMS, and Email
    • APIs
      • JSON Placeholder Todos API Integration in a Simple Blog App
      • Countries GraphQL API Integration Using the APIs feature in the Toolkit
      • Integrating the JSONPlaceholder Posts API Using the Toolkit’s OpenAPI Feature
      • OData Integration with the Bookings API Using the APIs feature
    • How to Configure In-App Notifications for User Profile Updates Using Communications
  • Enhancing Cases App: Real-time Comment Notifications
  • Reference articles
    • Glossary
    • Privacy by Design
    • OData
    • Razor
    • CRUD Functions
    • Mustache Templating
    • Temporal Tables
    • Integrating WhatsApp Business with the ComUnity Platform
    • Data Types
    • Field Types
    • Table Links
    • Release Notes
    • Keyboard Shortcuts
Powered by GitBook
On this page
  • Templating Rules
  • Contexts
Export as PDF
  1. Reference articles

Mustache Templating

The ComUnity Development Toolkit offers advanced templating capabilities that enhance dynamic data rendering and application interactivity. Within the Toolkit, application definitions are designed to support template values, streamlining the runtime binding of data and arguments.

Template Syntax

The standard format for a template is expressed as:

{{=<name>}}

At runtime, the template {{=<name>}} is seamlessly replaced with the corresponding data value for name. If the value is not available in the current context, the template reverts to an empty string.

Fields Supporting Templated Values

The fields in the Toolkit that typically support templated values are Data Path and Target URLs. These fields allow for dynamic referencing and navigation within the application, ensuring that data is always accurately presented and linked.

Key Features:

  1. Templating in Markdown:

    __Logged in as: {{=identifier}}__
    
  2. Templated Parameters in OData Queries:

    The Toolkit's support for templated parameters within OData 3.0 queries enables developers to devise detailed queries tailored to the application's specific needs see oData section for more details. This eradicates the constraints of using static values, granting developers the liberty to use dynamic placeholders for greater query adaptability.

  3. Dynamic Data Navigation Between Screens:

    Templating isn't limited to just data fetching. It also extends to inter-screen data navigation. By using templated URLs, developers can pass data between different screens in the application. For example, the following Target URL can be used to navigate to the FaultEditPage and pass the faultId value:

    LINK:FaultEditPage?faultId={{= FaultId }}

    In this scenario, the {{= FaultId }} placeholder gets substituted with the actual FaultId variable's value when the URL is triggered. This mechanism removes the necessity of hardcoded values, ensuring a more dynamic navigation experience.

Templating Rules

The following are the templating rules:

  • The {{= <name> }} template is used to replace the placeholder <name> with the value of the property name in the JSON payload.

  • The {{= <object>/<property> }} template is used to replace the placeholder <property> with the value of the property property in the object <object> in the JSON payload.

  • The . and / characters are interchangeable in the templates, so they can be used interchangeably to access properties in the JSON payload.

  • There are also special tags:

    {{= userguid }} - The Id of the current user
    {{= now }} - Current time

    These tags can be used to access information that is not stored in the JSON payload, such as the current user's Id or the current time.

Example

The following JSON payload is returned from the Data Service:

{
"name": "John",
"surname": "Doe",
"UserProfile": {
 "Suburb": "Rivonia",
 "Email": "jd@home.com"
 }
"Business": {
 "Name": "JD Take aways”,
 "BusinessType": {
 "Name": " Restaurants",
 "Description": "Places to eat"
                }
           }
}

The following table shows how each template is parsed during runtime:

Template

Parsed Value

Hello {{= name }}, welcome back

Hello John, welcome back

{{= UserProfile/Suburb }}

Rivonia

{{= Business.BusinessType.Name }}

Restaurants

Address: {{= Address }}

Address:

Contexts

There are two types of contexts in the ComUnity Development Toolkit:

  • User context: This context is always available and contains the session values from the UserProfile table for the current user. The values can be accessed using the following templates:

    • {{= profile/Cell }}

    • {{= profile.Name }}

  • Page / Form context: This context is unique and derived from a record and/or link argument values. The values can be accessed using the following templates:

    • {{= linkArgName }} - for a link argument (i.e. recordId)

    • {{= FieldName }} - for a specific field on a record (i.e. Name)

The user context is the most common context and is used to access the user's session values, such as their name, email address, and role. The page / form context is used to access the values of the arguments passed from parent links and the fields of the record that the page is referencing.