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 and most settings of actions.

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%]
6.1.0+ Returns the inbox name the form record currently resides in.
[%$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_NAME%]
The name of the current form.
[%$RECORD_ID%]
The ID of the current form record.
[%$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.

System variables with parameters

Syntax

[%$<Name>(<Parameter>...)%]
[%$DATE("<format>", <lang>)%]
6.0.5+  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>)%]
6.0.5+  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>)%]
6.0.5+  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)%]

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%]
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.
Tags:
Copyright 2000-2024