Skip to main content

Notification Template Reference

Overview

Protrak notification templates define the content of notifications (email + push) triggered by platform events. Templates use Razor markup syntax (@Model.*) and are stored as paired files:

  • NotificationTemplates/<title>.json — metadata (title, target, push message, state)
  • NotificationTemplates/<title>.html — HTML email body (Razor template)

Two templates are needed for a complete email notification: one for the subject (title ending in Subject) and one for the body (title ending in Body). Push-only templates need only the .json with a messageText value.

This reference covers the content of notification templates (the @Model variables and Razor syntax). For sending notifications imperatively from a program — building recipient lists and calling INotificationService.SendNotification — see the Send Notification Pattern.

Target Types

TargetTrigger eventUsage
PromoteNotificationLifecycle promote actionLink in a lifecycle's "Send Notification" command
AccountNotificationUser creation / password resetLink in Tenant Settings → Notifications
WorkflowNotificationWorkflow notification activityLink in Workflow → Notification Activity
WorkflowTaskNotificationWorkflow input/checklist task creationLink in Workflow → Input/Checklist Task Activity

@Model Variables — PromoteNotification

Available when target is PromoteNotification. These reflect the promoted instance.

@Model.InstanceName — Display name of the instance
@Model.InstanceUrl — Deep link URL to the instance
@Model.InstanceId — GUID of the instance
@Model.InstanceTrackingId — Tracking / reference number
@Model.PreviousStateName — Lifecycle state before the promote
@Model.CurrentStateName — Lifecycle state after the promote
@Model.ModifiedDate — Date/time of the promote (UTC)
@Model.ModifiedBy — Name of the user who triggered it
@Model.CreatedBy — Name of the user who created the instance
@Model.Remarks — Remarks entered on the promote action
@Model.AttributeValues["<AttributeName>"] — Attribute accessor (see below)
@Model.TenantInfo.TenantName
@Model.TenantInfo.LogoUrl
@Model.TenantInfo.DateTimeFormat.DateFormat
@Model.TenantInfo.DateTimeFormat.TimeFormat
@Model.TenantInfo.DateTimeFormat.TimeZone
@Model.TenantInfo.Locale.Name
@Model.TenantInfo.Locale.DisplayName
@Model.ApplicationUrl

@Model Variables — AccountNotification

Available when target is AccountNotification. These reflect the Protrak user account.

@Model.UserName
@Model.UserFullName
@Model.UserEmail
@Model.UserPassword
@Model.CompanyName
@Model.CompanyEmail
@Model.CompanyDomain
@Model.CompanyLogoUrl
@Model.UserRoles[index]
@Model.UserAttributes["<AttributeName>"]
@Model.MFAVerificationCode
@Model.MFAVerificationCodeValidity

@Model Variables — WorkflowNotification

Available when target is WorkflowNotification. These reflect the instance attached to the workflow.

@Model.InstanceName
@Model.InstanceUrl
@Model.InstanceId
@Model.InstanceTrackingId
@Model.ApplicationUrl
@Model.StateName
@Model.ModifiedDate
@Model.ModifiedBy
@Model.CreatedBy
@Model.AttributeValues["<AttributeName>"]

@Model Variables — WorkflowTaskNotification

Available when target is WorkflowTaskNotification. These reflect the workflow task.

@Model.InstanceName
@Model.InstanceUrl
@Model.InstanceId
@Model.InstanceTrackingId
@Model.ApplicationUrl
@Model.StateName
@Model.ModifiedDate
@Model.ModifiedBy
@Model.CreatedBy
@Model.AttributeValues["<AttributeName>"]
@Model.WorkflowTask.Id
@Model.WorkflowTask.Name
@Model.WorkflowTask.Description
@Model.WorkflowTask.Comments
@Model.WorkflowTask.Type
@Model.WorkflowTask.WorkflowInstanceId
@Model.WorkflowTask.PausedWorkflowInstActivityId
@Model.WorkflowTask.TypeInstId
@Model.WorkflowTask.Status
@Model.WorkflowTask.AssignedUserId
@Model.WorkflowTask.AssignedRoleId
@Model.WorkflowTask.Created
@Model.WorkflowTask.Due
@Model.WorkflowTask.Completed
@Model.WorkflowTask.CompletedBy
@Model.WorkflowTask.ChecklistItems[index].Id
@Model.WorkflowTask.ChecklistItems[index].Name
@Model.WorkflowTask.ChecklistItems[index].IsMandatory
@Model.WorkflowTask.ChecklistItems[index].IsCompleted

Attribute Value Accessors

The @Model.AttributeValues["<AttributeName>"] accessor returns an object with type-specific properties. Access the correct property based on the attribute type:

.TextValue — Text attributes
.NumericValue — Numeric attributes
.DateValue — Date attributes (stored as UTC DateTime)
.ArrayValue[0] — Picklist (single) — string value
.UserValues[0].UserName — User attributes (first user)
.UserValues[0].UserEmail
.UserValues[0].UserId
.ReferenceValue[0].Name — Reference attributes (first linked instance)
.ReferenceValue[0].Id

Razor Syntax Examples

Simple substitution

<p>Hi @Model.AttributeValues["Employee"].UserValues[0].UserName,</p>
<p>Your <a href='@Model.InstanceUrl'>@Model.InstanceName</a> has been approved.</p>

Conditional content

@if (Model.AttributeValues["Country"].ArrayValue[0] == "India")
{
<span>Tax rate: @Model.AttributeValues["GSTRate"].NumericValue%</span>
}
else
{
<span>No tax applicable.</span>
}

Null-safe access

@(Model.AttributeValues.ContainsKey("Title")
? Model.AttributeValues["Title"]?.TextValue ?? "N/A"
: "N/A")

File Format

<title>.json

{
"title": "Invoice Sent Body",
"target": "PromoteNotification",
"emailText": null,
"hashCode": "",
"messageText": null,
"templateState": "Published"
}
  • emailText is always null in file-based templates — the email body lives in the .html file.
  • hashCode is left empty; Protrak recomputes it on import (same pattern as programHashCode).
  • messageText is the plain-text push notification content (Razor syntax supported).
  • templateState: "Published" or "InProgress".

<title>.html

<p>Hi @Model.AttributeValues["Manager"].UserValues[0].UserName,</p>
<p>Invoice <strong>@Model.InstanceName</strong> has been sent to the client.</p>
<p><a href='@Model.InstanceUrl'>View invoice</a></p>
<p><i>This is a system generated mail, please do not reply.</i></p>