Articles in this section

getValue helper

The getValue helper retrieves the value at a specified field path and returns an optional fallback if the field is missing or null. Use it when field names are dynamic or not known in advance -- for example, when the field path itself is stored in another field.

Syntax

{{getValue fieldPath "defaultValue"}}

fieldPath -- The path to the field to retrieve, passed as a string (e.g. "record.customerId") or as the result of another expression. Required.

defaultValue -- The value to return if the specified field is missing or null. Optional but recommended when the field path may not always exist.

Examples

Retrieve a field with a fallback

{{getValue "record.email" "no-email@example.com"}}

If record.email is "jane.doe@example.com", that value is returned. If record.email is missing or null, the helper returns "no-email@example.com".

Return a fallback for a missing field

{{getValue "shipping.trackingNumber" "Not Assigned"}}

If shipping.trackingNumber doesn't exist or is null, the helper returns "Not Assigned".

Resolve a dynamic field name at runtime

{{getValue (getValue "record.dynamicFieldName")}}

If record.dynamicFieldName is "promoCode", the inner getValue returns "promoCode". The outer getValue then retrieves the value of record.promoCode. Use this pattern when the field name to look up is itself stored in another field -- for example, when field names are date-based or user-defined.

Usage notes

  • Always provide a defaultValue when the field path may be missing or null to avoid empty output.
  • getValue can behave unexpectedly inside a #each block if it can't resolve the full context path. Reference known fields directly inside loops, or retrieve the needed value before entering the loop.
  • Nest getValue calls to build field paths dynamically at runtime when the field name isn't known in advance.