Variables


Variables are used to dynamically insert the value of form fields, the results of actions, certain system properties and more. They are available to templates, most settings of actions and data base queries.

As a common use case, consider a form allowing a user to enter their email address. When you would like to send an email to the address they entered, variables must be used.

Using variables

Symbol for opening a variable selection on an option field and a text field as it is used inside the action type E-mail.

The variable selection menu. Here you can select the form field whose value is to be used.

Using variables for actions

Form fields can be selected by clicking on the variable icon to the right of each action setting supporting variables.

Using variables for templates

Variables may be used for templates as well. The button Variables at the bottom opens the variable selection menu.

The variable selection menu can be opened either by clicking the button the the right hand side of the template editor or by pressing Ctrl + Space.

Variable types

Form elements

Syntax

[%<FormFieldName>%]

This variable takes the value of the form field with the specified name. They are used mainly for actions such as Email, Create text file, Database query as well as for Templates.

Example: The variable [%tfEmail%] will take the value of the input field named tfEmail.

Special form elements

There are some special variables available:

[%xf-action%]
The name of the button used for submitting the form. Could be used to execute an action in the workflow only when a certain button was used (by adding an appropriate condition to the action).
[%lang%]
Refers to the language of the form when it was filled out, eg. de, de-CH, en, or fr-FR.

System variables

Syntax

[%$<Name>%]

System variables take the value of the corresponding system value. The following system variables are available for actions and templates:

[%$CLIENT_ID%]
The client ID of the client of the current form.
[%$FORM_LINK%]
The URL of the current form.
[%$FORM_PROCESS_LINK%]
The URL of the current form for the current process.
[%$FORM_VERIFY_LINK%]
The URL to confirm Double opt in. Can only be used once.
[%$FORM_INBOX_NAME%]
Returns the inbox name the form record currently resides in.
[%$FORM_INBOX_LINK%]
Returns the inbox link the form record currently resides in.
[%$FORM_INVITE_LINK%]
Returns the invitation link of the form.
[%$PROCESS_ID%]
The current process ID of the form record.
[%$PROJECT_ALIAS%]
The alias of the current form.
[%$PROJECT_ID%]
The form ID of the current form.
[%$PROJECT_TITLE%]
The title of the current form.
[%$RECORD_ID%]
The ID of the current form record.
[%$RECORD_READ%]
Whether the current form record was read. Evaluated as a Boolean, i.e. true or false.
[%$RECORD_UNREAD%]
Whether the current form record was not read. Evaluated as a Boolean, i.e. true or false.
[%$RECORD_ATTR.<customAttrKey>%]
  Read user-defined form record attributes (e.g. [%$RECORD_ATTR.loopCount%]). This allows values to be stored on the form record and accessed in any action.
[%$SOURCE_SERVER%]
The name of the server that has provided the current form, either the name of the frontend server or the local server.
[%$SOURCE_SERVER_URL%]
The URL of the server that has provided the current form, either the name of the frontend server or the local server.
[%$STATUS_ID%]
The ID of the current state.
[%$STATUS_NAME%]
The name of the current state.
[%$STATUS_TYPE%]
The type of the current state. These four values are possible: RECEIVED , SAVED, ERROR and CUSTOM (Custom status created by user).
[%$TRIGGER.actionName%]
The name of the action of the providing event.
[%$TRIGGER.taskName%]
The name of the task where the action of the event is located.
[%$TRIGGER.triggerName%]
The name of the event where the action of the event is located.
[%$COUNTER_CLIENT.<counterName>%]
The current value of a client counter.

System variables with parameters

Syntax

[%$<Name>(<Parameter>...)%]
[%$DATE("<format>", <lang>)%]
Current date. The parameters are optional. When no parameter is specified, the date will be returned in default format. You can specify a custom date format with the first parameter, see the java.text.SimpleDateFormat for more info on the date format string. The second parameter specifies the language, which affects the names of weekdays and months. Example: [%$DATE("yyyy/MM/dd", en-GB)%]
[%$FORM_DATE_CREATED("<format>", <lang>)%]
Creation date of the form record. The parameters are optional. When no parameter is specified, the date will be returned in default format. You can specify a custom date format with the first parameter, see the java.text.SimpleDateFormat for more info on the date format string. The second parameter specifies the language, which affects the names of weekdays and months. Example: [%$FORM_DATE_CREATED("yyyy/MM/dd", en-GB)%]
[%$FORM_DATE_MODIFIED("<format>", <lang>)%]
Available with FORMCYCLE version 6.0.5{{/info}} Last change date of the form record. The parameters are optional. When no parameter is specified, the date will be returned in default format. You can specify a custom date format with the first parameter, see the java.text.SimpleDateFormat for more info on the date format string. The second parameter specifies the language, which affects the names of weekdays and months. Example: [%$FORM_DATE_MODIFIED("yyyy/MM/dd", en-GB)%]

User variables


Using user variables to prefill form fields with data of the logged in user.

Using user variables to prefill form fields with data of the logged in user.

User variables may be used in actions, templates, data base queries or directly in form elements for prefilling the form (see figure).

Syntax

[%$<user object>.<attribute>%]

There are three user objects available which can be used to access information about the user (user profile). If a user variable is being used without any attributes (e.g. [%$USER%]), all user information will be returned in JSON format.

For sensible use of the user variables it is necessary to enable form login. If this is not configured the user object will be set to an anonymous user.

User objects

[%$USER%]
User object for accessing the current user.
[%$LAST_USER%]
User object for accessing the last user.
[%$INITIAL_USER%]
User object for accessing the user that submitted the form.

Attributes

Using attributes on user objects permits access to specific user information. The following attributes are available for all users but may not always have a value. If the attribute contains a value depends on the authenticator being used for logging into the form.

Example: The user variable [%$USER.mail%] returns the email address of the user that has logged into the form.

authTypeId
ID of the authenticator the user chose for login.
displayName
Display name of the user
familyName
Family name of the user
firstName
First name of the user
gender
Gender of the user
groups
Group names of the user
id
ID of the user. (system ID for FORMCYCLE users)
linkedId
A user profile may have a linked identifier, which is the identifier of another user profile.
locale
Language of the user
location
Location of the user
mail
email address of the user
phone
phone number of the user
pictureUrl
URL to the profile picture of the user
profileUrl
URL to the profile of the user
rawData
All the information about the user in a JSON format. Depending on the chosen authenticator, the raw data may include additional information about the user that can otherwise not be accessed through attributes.
role
Role of the user
title
Title of the user
typedId
Type of the authenticator the user chose for login.
userName
user name

Appointment variables

Appointment variables can be used when appointments are booked with the form.

Syntax

[%$<Name>%]
[%$APPOINTMENT_LIST%]
Creates a summary of the dates booked with the form record in the form of a ul HTML list. For each appointment a button is also created, with which the booked appointment can be added to a calendar. This variable is intended for use in HTML templates.
[%$APPOINTMENT_LINK%]
Creates a link to an iCal file that contains all the dates of the form record.

System variables for HTML templates

Syntax

[%$<Name>(<Parameter1>,<Parameter2>)%]

In addition to the system variables available to both workflow actions and templates, the following variables can be used only in HTML templates. They are used for downloading attachments and are valid for the same browser session that was active when the form was submitted.

[%$ATTACHMENT_LIST%]
Inserts a list with all available attachments that can be downloaded. This will create an ul element.
[%$ATTACHMENT_ZIP=fileName,linkText%]
Creates a link for downloading all attachments as a zip archive. Optionally you may specify the parameters fileName and linkText. The following variations are possible:
[%$ATTACHMENT_ZIP=fileName,linkText%]
Creates a link with the text linkText for downloading all attachements a zip archive that will be named fileName.
[%$ATTACHMENT_ZIP=fileName%]
Creates a link with the text fileName for dowloading all attachments a zip file that will be named fileName.
[%$ATTACHMENT_ZIP%]
Creates a link with the text attachment.zip for downloading all attachements as a zip file named attachment.zip.
[%$ATTACHMENT=attachmentName,linkText,fileName%]
Creates a link for downloading a single attachment with the given name that must have been created as part of the workflow processing. The parameters linkText and fileName are optional, allowing for the following combinations:
[%$ATTACHMENT=attachmentName,linkText,fileName%]
Creates a link with the text linkText for downloading a single attachment with the name attachmentName as a file named fileName.
[%$ATTACHMENT=attachmentName,linkText%]
Creates a link with the text linkText for an attachment with the name attachmentName.
[%$ATTACHMENT=attachmentName%]
Creates a link for downloading an attachment with the name attachmentName.

When the specified attachment does not exist, these variables will not have any effect and will be removed from the rendered HTML template.

Template variables

Syntax

[%$$<Name>%]

A template variables takes the value of the content of a template (for example text, email, or link) and can be used by workflow action such as Email.

Action variables

Syntax

[%$<actionName>.<returnValue>%]

Some actions have got return values that can accessed by action variables.

These variables look similar to system variables, but they contain a period as a separator for the action name and the return value. The following action variables are available.

[%$<actionName>.SUCCESS%]
Whether the action could be processed successfully. Evaluates to a boolean, ie. true or false.
[%$<actionName>.COUNT%]
This variable is not supported in the new workflow.
The number of results. Evaluates to an integer value.
[%$<actionName>.RESULT%]
A single return value. Evaluates to a string value.
[%$<actionName>.RESULT[<Index>].<Identifier>%]
Certain actions may return more than one result, corresponding to a List<Map<String,String>> in Java. The index and identifier is set by the corresponding action implementation and cannot be changed. This is used mostly by custom plugins when multiple values need to be returned.
[%$<actionName>.ERROR_CODE%]
In case of error the thrown error code of the action.
[%$<actionName>.ERROR_MESSAGE%]
In case of error the thrown error message of the action.