Skip to main content

Workflow Template Variable Reference

This page provides the complete reference for all template variables available in Resgrid Workflows. Variables use Scriban syntax: {{ variable.property }}.

Every workflow template has access to common variables (department, timestamp, user) plus event-specific variables that depend on the trigger event type.

Common Variables​

These variables are available in every workflow regardless of trigger event type.

Department Variables​

VariableTypeDescription
{{ department.id }}intDepartment ID
{{ department.name }}stringDepartment name
{{ department.code }}string4-character department code
{{ department.type }}stringDepartment type (Fire, EMS, etc.)
{{ department.time_zone }}stringDepartment time zone ID
{{ department.use_24_hour_time }}bool24-hour time preference
{{ department.created_on }}datetimeDepartment creation date
{{ department.address.street }}stringStreet address
{{ department.address.city }}stringCity
{{ department.address.state }}stringState/Province
{{ department.address.postal_code }}stringPostal/ZIP code
{{ department.address.country }}stringCountry
{{ department.address.full }}stringFull formatted address
{{ department.phone_number }}stringDepartment phone number (from settings)

Timestamp Variables​

VariableTypeDescription
{{ timestamp.utc_now }}datetimeCurrent UTC timestamp
{{ timestamp.department_now }}datetimeCurrent time in department's time zone
{{ timestamp.date }}stringCurrent date (department TZ) as yyyy-MM-dd
{{ timestamp.time }}stringCurrent time (department TZ) as HH:mm:ss or hh:mm tt
{{ timestamp.day_of_week }}stringDay name (e.g., "Monday")

Run Variables​

Set for every step of every run.

VariableTypeDescription
{{ run.id }}stringWorkflow run ID
{{ run.attempt }}intAttempt number (1 on the first try)
{{ run.idempotency_key }}string32 hex characters, the same on every retry of this step's delivery and different for every event. Use it as an Idempotency-Key, a FHIR identifier or HL7 MSH-10 so a retried delivery isn't recorded twice

Template Helpers​

Available in every workflow template. Pipe a value into them.

HelperExampleResult
json_escape"{{ call.notes \| json_escape }}"The value escaped for use inside a JSON string (quotes, backslashes, control characters, <, >, &)
xml_escape<note>{{ call.notes \| xml_escape }}</note>The value escaped for XML text or attributes; characters XML can't carry are dropped
hl7_escapeOBX\|1\|TX\|NOTE\|\|{{ call.notes \| hl7_escape }}HL7 v2 escaping of \| ^ ~ \ &, with CR and LF turned into \X0D\ and \X0A\
fhir_datetime{{ call.closed_on \| fhir_datetime }}2026-09-24T14:05:00Z (UTC)
hl7_ts{{ call.closed_on \| hl7_ts }}20260924140500+0000 (UTC)

User Variables (Triggering User)​

Populated from the user who triggered the event. If no specific user is associated with the event (e.g., Unit Added, Shift Created), these variables are empty/null.

VariableTypeDescription
{{ user.id }}stringUser ID
{{ user.first_name }}stringFirst name
{{ user.last_name }}stringLast name
{{ user.full_name }}stringFull name ("First Last")
{{ user.email }}stringEmail address
{{ user.mobile_number }}stringMobile phone number
{{ user.home_number }}stringHome phone number
{{ user.identification_number }}stringID/badge number
{{ user.username }}stringLogin username
{{ user.time_zone }}stringUser's personal time zone

Event-Specific Variables​

Call Added / Call Updated / Call Closed​

Triggering user: The reporting user (Call.ReportingUserId)

VariableTypeDescription
{{ call.id }}intCall ID
{{ call.number }}stringCall number
{{ call.name }}stringCall name
{{ call.nature }}stringNature of call
{{ call.notes }}stringCall notes
{{ call.address }}stringCall address
{{ call.geo_location }}stringGPS coordinates
{{ call.type }}stringCall type
{{ call.incident_number }}stringIncident number
{{ call.reference_number }}stringReference number
{{ call.map_page }}stringMap page reference
{{ call.priority }}intPriority level
{{ call.priority_text }}stringPriority as text (Low, Medium, High, Emergency)
{{ call.is_critical }}boolWhether the call is critical
{{ call.state }}intCall state code
{{ call.state_text }}stringCall state as text (Active, Closed, etc.)
{{ call.source }}intCall source code
{{ call.external_id }}stringExternal identifier
{{ call.logged_on }}datetimeWhen the call was logged
{{ call.closed_on }}datetimeWhen the call was closed (null if open)
{{ call.completed_notes }}stringClosure/completion notes
{{ call.contact_name }}stringContact person name
{{ call.contact_number }}stringContact phone number
{{ call.w3w }}stringWhat3Words location
{{ call.dispatch_count }}intNumber of dispatched resources
{{ call.dispatch_on }}datetimeWhen dispatch occurred
{{ call.form_data }}stringCustom form data
{{ call.is_deleted }}boolWhether the call is deleted
{{ call.deleted_reason }}stringDeletion reason
{{ call.part2_consent_on_file }}bool42 CFR Part 2 consent (or another Part 2 basis) is on file for the call. Never protected, so conditions can use it
Advanced Data Protection

In a department with Advanced Data Protection, the protected call fields above (name, nature, notes, address, geolocation, type, incident, reference and external numbers, completion notes, contact name and number, what3words, form data, deletion reason) render as REDACTED. A workflow with an approved Protected Workflow release also gets the fields it was approved for under protected.call.* (for example protected.call.completed_notes, protected.call.form with the form data parsed, protected.call.subject_ids.<key> for the call's subject identifiers, and protected.call.udf.<field name> for released call custom fields), in its output template only. Subject identifiers are never available under call.*. Anywhere else, protected.* renders as an empty string.

Call Collection Variables​

The following array variables are available on call events. Use Scriban for loops to iterate over them.

Dispatched Personnel (call.dispatches)​
VariableTypeDescription
{{ call.dispatches }}arrayList of dispatched personnel
{{ call.dispatches[n].user_id }}stringDispatched user ID
{{ call.dispatches[n].dispatch_count }}intDispatch count
{{ call.dispatches[n].dispatched_on }}datetimeDispatch timestamp
Dispatched Units (call.unit_dispatches)​
VariableTypeDescription
{{ call.unit_dispatches }}arrayList of dispatched units
{{ call.unit_dispatches[n].unit_id }}intUnit ID
{{ call.unit_dispatches[n].unit_name }}stringUnit name
{{ call.unit_dispatches[n].dispatch_count }}intDispatch count
{{ call.unit_dispatches[n].dispatched_on }}datetimeDispatch timestamp
Dispatched Groups (call.group_dispatches)​
VariableTypeDescription
{{ call.group_dispatches }}arrayList of dispatched groups
{{ call.group_dispatches[n].group_id }}intGroup ID
{{ call.group_dispatches[n].group_name }}stringGroup name
{{ call.group_dispatches[n].dispatch_count }}intDispatch count
{{ call.group_dispatches[n].dispatched_on }}datetimeDispatch timestamp
Dispatched Roles (call.role_dispatches)​
VariableTypeDescription
{{ call.role_dispatches }}arrayList of dispatched roles
{{ call.role_dispatches[n].role_id }}intRole ID
{{ call.role_dispatches[n].role_name }}stringRole name
{{ call.role_dispatches[n].dispatch_count }}intDispatch count
{{ call.role_dispatches[n].dispatched_on }}datetimeDispatch timestamp
Call Notes (call.notes_list)​
VariableTypeDescription
{{ call.notes_list }}arrayList of call notes
{{ call.notes_list[n].note }}stringNote text
{{ call.notes_list[n].source }}stringNote source
{{ call.notes_list[n].timestamp }}datetimeNote timestamp
{{ call.notes_list[n].user_id }}stringNote author user ID
Call Contacts (call.contacts)​
VariableTypeDescription
{{ call.contacts }}arrayList of call contacts
{{ call.contacts[n].name }}stringContact name
{{ call.contacts[n].number }}stringContact number
{{ call.contacts[n].type }}stringContact type
Example: Iterating Over Dispatched Units​
{{ for unit in call.unit_dispatches }}
- {{ unit.unit_name }} (dispatched {{ unit.dispatched_on | date.to_string "%H:%M" }})
{{ end }}

Unit Status Changed​

Triggering user: None (unit-based event; user.* variables will be empty)

Current Status​

VariableTypeDescription
{{ unit_status.id }}intUnit state record ID
{{ unit_status.state }}intCurrent state code
{{ unit_status.state_text }}stringCurrent state as text
{{ unit_status.timestamp }}datetimeWhen the status changed
{{ unit_status.note }}stringStatus change note
{{ unit_status.latitude }}decimalLatitude at time of change
{{ unit_status.longitude }}decimalLongitude at time of change
{{ unit_status.destination_id }}intDestination ID (if applicable)

Unit Details​

VariableTypeDescription
{{ unit.id }}intUnit ID
{{ unit.name }}stringUnit name
{{ unit.type }}stringUnit type
{{ unit.vin }}stringVehicle Identification Number
{{ unit.plate_number }}stringLicense plate number
{{ unit.station_group_id }}intAssigned station group ID

Previous Status​

VariableTypeDescription
{{ previous_unit_status.state }}intPrevious state code
{{ previous_unit_status.state_text }}stringPrevious state as text
{{ previous_unit_status.timestamp }}datetimePrevious status timestamp

Personnel Staffing Changed​

Triggering user: The user whose staffing changed (UserState.UserId)

Current Staffing​

VariableTypeDescription
{{ staffing.id }}intStaffing record ID
{{ staffing.state }}intCurrent staffing state code
{{ staffing.state_text }}stringStaffing state as text (Available, Delayed, etc.)
{{ staffing.timestamp }}datetimeWhen the staffing changed
{{ staffing.note }}stringStaffing change note

Previous Staffing​

VariableTypeDescription
{{ previous_staffing.state }}intPrevious staffing state code
{{ previous_staffing.state_text }}stringPrevious staffing state as text
{{ previous_staffing.timestamp }}datetimePrevious staffing timestamp

Personnel Status Changed​

Triggering user: The user whose status changed (ActionLog.UserId)

Current Status​

VariableTypeDescription
{{ status.id }}intAction log record ID
{{ status.action_type }}intAction type code
{{ status.action_text }}stringAction as text (Standing By, Responding, etc.)
{{ status.timestamp }}datetimeWhen the status changed
{{ status.geo_location }}stringGPS coordinates at time of change
{{ status.destination_id }}intDestination ID (if applicable)
{{ status.note }}stringStatus change note

Previous Status​

VariableTypeDescription
{{ previous_status.action_type }}intPrevious action type code
{{ previous_status.action_text }}stringPrevious action as text
{{ previous_status.timestamp }}datetimePrevious status timestamp

User Created​

Triggering user: The newly created user

VariableTypeDescription
{{ new_user.id }}stringNew user's ID
{{ new_user.username }}stringNew user's username
{{ new_user.email }}stringNew user's email
{{ new_user.name }}stringNew user's display name

User Assigned to Group​

Triggering user: The user being assigned (UserAssignedToGroupEvent.UserId)

Assigned User​

VariableTypeDescription
{{ assigned_user.id }}stringUser ID
{{ assigned_user.name }}stringUser name

New Group​

VariableTypeDescription
{{ group.id }}intGroup ID
{{ group.name }}stringGroup name
{{ group.type }}intGroup type
{{ group.dispatch_email }}stringGroup dispatch email
{{ group.latitude }}stringGroup latitude
{{ group.longitude }}stringGroup longitude

Previous Group​

VariableTypeDescription
{{ previous_group.id }}intPrevious group ID
{{ previous_group.name }}stringPrevious group name

Document Added​

Triggering user: The user who uploaded the document (Document.UserId)

VariableTypeDescription
{{ document.id }}intDocument ID
{{ document.name }}stringDocument name
{{ document.category }}stringDocument category
{{ document.description }}stringDocument description
{{ document.type }}stringDocument type
{{ document.filename }}stringOriginal filename
{{ document.admins_only }}boolWhether restricted to admins
{{ document.added_on }}datetimeUpload timestamp

Note Added​

Triggering user: The user who created the note (Note.UserId)

VariableTypeDescription
{{ note.id }}intNote ID
{{ note.title }}stringNote title
{{ note.body }}stringNote body text
{{ note.color }}stringNote color
{{ note.category }}stringNote category
{{ note.is_admin_only }}boolWhether restricted to admins
{{ note.added_on }}datetimeCreation timestamp
{{ note.expires_on }}datetimeExpiration date (if set)

Unit Added​

Triggering user: None

VariableTypeDescription
{{ unit.id }}intUnit ID
{{ unit.name }}stringUnit name
{{ unit.type }}stringUnit type
{{ unit.vin }}stringVehicle Identification Number
{{ unit.plate_number }}stringLicense plate number
{{ unit.station_group_id }}intAssigned station group ID
{{ unit.four_wheel }}boolFour-wheel drive capability
{{ unit.special_permit }}boolSpecial permit status

Log Added​

Triggering user: The user who created the log (Log.LoggedByUserId)

VariableTypeDescription
{{ log.id }}intLog ID
{{ log.narrative }}stringLog narrative
{{ log.type }}stringLog type name
{{ log.log_type }}intLog type code
{{ log.external_id }}stringExternal identifier
{{ log.initial_report }}stringInitial report text
{{ log.course }}stringTraining course name
{{ log.course_code }}stringTraining course code
{{ log.instructors }}stringInstructor names
{{ log.cause }}stringIncident cause
{{ log.contact_name }}stringContact person name
{{ log.contact_number }}stringContact phone number
{{ log.location }}stringLog location
{{ log.started_on }}datetimeActivity start time
{{ log.ended_on }}datetimeActivity end time
{{ log.logged_on }}datetimeWhen the log was created
{{ log.other_agencies }}stringOther agencies involved
{{ log.other_units }}stringOther units involved
{{ log.other_personnel }}stringOther personnel involved
{{ log.call_id }}intAssociated call ID (if linked)

Log Collection Variables​

VariableTypeDescription
{{ log.entries }}arrayList of log entries
{{ log.entries[n].narrative }}stringEntry narrative
{{ log.entries[n].timestamp }}datetimeEntry timestamp
{{ log.entries[n].user_id }}stringEntry author user ID

Calendar Event Added / Calendar Event Updated​

Triggering user: The event creator (CalendarItem.CreatorUserId)

VariableTypeDescription
{{ calendar.id }}intCalendar item ID
{{ calendar.title }}stringEvent title
{{ calendar.description }}stringEvent description
{{ calendar.location }}stringEvent location
{{ calendar.start }}datetimeStart date/time
{{ calendar.end }}datetimeEnd date/time
{{ calendar.is_all_day }}boolWhether it's an all-day event
{{ calendar.item_type }}intCalendar item type code
{{ calendar.signup_type }}intSignup type code
{{ calendar.is_public }}boolWhether the event is public

Shift Created / Shift Updated​

Triggering user: None

VariableTypeDescription
{{ shift.id }}intShift ID
{{ shift.name }}stringShift name
{{ shift.code }}stringShift code
{{ shift.schedule_type }}intSchedule type code
{{ shift.assignment_type }}intAssignment type code
{{ shift.color }}stringDisplay color
{{ shift.start_day }}datetimeShift start day
{{ shift.start_time }}stringShift start time
{{ shift.end_time }}stringShift end time
{{ shift.hours }}intShift duration in hours
{{ shift.department_number }}stringDepartment number

Shift Collection Variables​

VariableTypeDescription
{{ shift.groups }}arrayList of shift group assignments
{{ shift.groups[n].group_id }}intGroup ID
{{ shift.groups[n].group_name }}stringGroup name

Resource Order Added​

Triggering user: None (department-level event)

VariableTypeDescription
{{ order.id }}intResource order ID
{{ order.title }}stringOrder title
{{ order.incident_number }}stringIncident number
{{ order.incident_name }}stringIncident name
{{ order.incident_address }}stringIncident address
{{ order.summary }}stringOrder summary
{{ order.open_date }}datetimeOrder open date
{{ order.needed_by }}datetimeResources needed by date
{{ order.contact_name }}stringContact person name
{{ order.contact_number }}stringContact phone number
{{ order.special_instructions }}stringSpecial instructions
{{ order.meetup_location }}stringMeetup location
{{ order.financial_code }}stringFinancial/billing code

Resource Order Collection Variables​

VariableTypeDescription
{{ order.items }}arrayList of order line items
{{ order.items[n].resource }}stringRequested resource
{{ order.items[n].quantity }}intRequested quantity
{{ order.items[n].status }}stringItem status

Shift Trade Requested​

Triggering user: None

VariableTypeDescription
{{ shift_trade.id }}intShift trade ID
{{ shift_trade.department_number }}stringDepartment number

Shift Trade Filled​

Triggering user: The user who filled the trade (ShiftTradeFilledEvent.UserId)

VariableTypeDescription
{{ shift_trade.id }}intShift trade ID
{{ shift_trade.filled_by_user_id }}stringUser who filled the trade
{{ shift_trade.department_number }}stringDepartment number

Message Sent​

Triggering user: The user who sent the message (Message.SendingUserId)

VariableTypeDescription
{{ message.id }}intMessage ID
{{ message.subject }}stringMessage subject
{{ message.body }}stringMessage body
{{ message.is_broadcast }}boolWhether it's a broadcast message
{{ message.sent_on }}datetimeWhen the message was sent
{{ message.type }}intMessage type code
{{ message.recipients }}stringMessage recipients
{{ message.expire_on }}datetimeMessage expiration date (if set)

Training Added / Training Updated​

Triggering user: The user who created the training (Training.CreatedByUserId)

VariableTypeDescription
{{ training.id }}intTraining ID
{{ training.name }}stringTraining name
{{ training.description }}stringTraining description
{{ training.training_text }}stringTraining content text
{{ training.minimum_score }}doubleMinimum passing score
{{ training.created_on }}datetimeCreation date
{{ training.to_be_completed_by }}datetimeCompletion deadline (if set)

Training Collection Variables​

VariableTypeDescription
{{ training.questions }}arrayList of training quiz questions
{{ training.questions[n].question }}stringQuestion text
{{ training.questions[n].answer }}stringCorrect answer

Inventory Adjusted​

Triggering user: The user who made the adjustment (Inventory.AddedByUserId)

VariableTypeDescription
{{ inventory.id }}intInventory record ID
{{ inventory.type_name }}stringInventory type name
{{ inventory.type_description }}stringInventory type description
{{ inventory.unit_of_measure }}stringUnit of measure
{{ inventory.batch }}stringBatch identifier
{{ inventory.note }}stringAdjustment note
{{ inventory.location }}stringStorage location
{{ inventory.amount }}doubleCurrent amount
{{ inventory.previous_amount }}doubleAmount before adjustment
{{ inventory.timestamp }}datetimeAdjustment timestamp
{{ inventory.group_id }}intGroup/station ID

Certification Expiring​

Triggering user: The user whose certification is expiring (PersonnelCertification.UserId)

VariableTypeDescription
{{ certification.id }}intCertification record ID
{{ certification.name }}stringCertification name
{{ certification.number }}stringCertification number
{{ certification.type }}stringCertification type
{{ certification.area }}stringCertification area/specialty
{{ certification.issued_by }}stringIssuing authority
{{ certification.expires_on }}datetimeExpiration date
{{ certification.received_on }}datetimeDate received
{{ certification.days_until_expiry }}intDays until expiration

Form Submitted​

Triggering user: The user who submitted the form (FormSubmittedEvent.SubmittedByUserId)

VariableTypeDescription
{{ form.id }}stringForm ID
{{ form.name }}stringForm name
{{ form.type }}intForm type code
{{ form.submitted_data }}stringSubmitted form data (JSON)
{{ form.submitted_by_user_id }}stringSubmitting user ID
{{ form.submitted_on }}datetimeSubmission timestamp

Personnel Role Changed​

Triggering user: The user whose role changed (PersonnelRoleChangedEvent.UserId)

VariableTypeDescription
{{ role_change.user_id }}stringAffected user ID
{{ role_change.role_id }}intPersonnel role ID
{{ role_change.role_name }}stringRole name
{{ role_change.role_description }}stringRole description
{{ role_change.action }}string"Added" or "Removed"

Group Added / Group Updated​

Triggering user: None

VariableTypeDescription
{{ group.id }}intGroup ID
{{ group.name }}stringGroup name
{{ group.type }}intGroup type code
{{ group.dispatch_email }}stringDispatch email address
{{ group.message_email }}stringMessage email address
{{ group.latitude }}stringLatitude
{{ group.longitude }}stringLongitude
{{ group.what3words }}stringWhat3Words location
{{ group.address.street }}stringStreet address
{{ group.address.city }}stringCity
{{ group.address.state }}stringState/Province
{{ group.address.postal_code }}stringPostal/ZIP code
{{ group.address.country }}stringCountry