Table of Contents


Functions and Merge Fields - Syntax and Examples

 

The following sections describe the characters and formatting used in functions and Merge Fields.

Notation

The following characters are used for the described purposes in functions and Merge Fields:

  • Curly Braces and Exclamation point - {!example}

    Indicate the bounds of the function or Merge Field.

  • Parentheses - (example-arg)

    Indicate the arguments section of a function.

  • Commas - example1,example2

    Separate multiple arguments in functions that accept more than one argument.

  • Quotation Marks - "example"

    Indicates a text string. Within functions, text strings can be used to return values according to the object's name.

  • Periods - example.example

    Only used in Merge Fields. Indicate a change in field level for Merge Fields with lookup fields.

  • Dollar Sign - $example

    Only used in Standard Merge Fields. Indicates the Merge Field is a Standard Merge Field.

Syntax

The following templates demonstrate the basic syntax for functions and Merge Fields:

  • Functions:{!functionName([arg1],[arg2],[etc.])}
  • Merge Fields: {![Entity].[LookupField1.LookupField2.etc.]Field}
  • Standard Merge Fields: {!$StandardMergeField.[LookupField1.LookupField2.etc.]Field}

The following syntax rules apply to functions and Merge Fields:

  • Both functions and Merge Fields must open and close with curly braces and the opening curly brace must be followed by an exclamation point. This rule also applies to nested functions or Merge Fields. For example, the arguments of the function {!OR(Equal(5,5),LessThan(10,5))} are functions and therefore indicated with the curly braces and exclamation point.
  • Functions always contain an arguments section indicated by parentheses, even when the function does not accept arguments. For example, the function {!Today()} has parentheses but no arguments within the parentheses.
  • When a function accepts multiple arguments, commas are used to separate them. No spaces appear before or after commas. For example, the function Concat("str1","str2","str3") accepts multiple string arguments with only commas between them.
  • When strings are passed as arguments, they must be encased in quotation marks. Within functions, strings can reference fields and return the corresponding value. For example, the function {!ActivePageUrl("ExamplePage")} returns the URL for the Active Page with the name "ExamplePage".
  • Functions and Merge Fields do not accept line breaks and spaces in their syntax.
  • Merge Fields are references to values held in Entity records. Merge Fields never contain an arguments section.

Example functions and merge fields

The following examples demonstrate how functions and Merge Fields are syntactically formatted.

Example functions

{!MoreThan(LEN(ProductInventory.Description),10)}

Logical function that evaluates whether the string of the Description field in the Product Inventory Entity is greater than 10 characters. If the string is greater than 10 characters, the function returns True, else False.

{!If(IsInRole("Client Portal User"),ActivePageUrl("Client"),ActivePageUrl("Public"))}

Logical function that evaluates whether the current authenticated user has the "Client Portal User" security role. If the user has this role, they are directed to the Active Page "Client"; if not, they are directed to the Active Page "Public".

Example merge fields

{!Force__Contact.CreatedBy.Username}

Merge Field that returns the portal username of the user that created the Contact.

{!AddDateTimePart($Today,"days",5)}

Standard Merge Field being passed as an argument for a function. This example returns a date that is exactly five days from the current date.


 

<< Functions and Merge Fields | Functions and Merge Field Case Scenarios >>