Variables
Variables, sometimes also called placeholders, 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 users to enter their mail addresses. When you would like to send a mail to the address they entered, variables must be used.
Using variables
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
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 field variables
Syntax
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 [%tfName%] will take the value of the input field named Name.
Special form field variables
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/ oder fr-FR.
System variables
Syntax
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%]
TBD.[%$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 paramters
Syntax
[%$DATE(<format>, <lang>)%]
Current date. The parameter are optional. Without the paramter the date will be returned in default format. The paramter are used to determine the format and language.Example: [%$DATE("yyyy/mm/dd", en-GB)%]
(see SimpleDateFormat)
[%$FORM_DATE_CREATED(<format>, <lang>)%]
Creation date of the form record. The parameter are optional. Without the paramter the date will be returned in default format. The paramter are used to determine the format and language.Example: [%$FORM_DATE_CREATED("yyyy/mm/dd", en-GB)%]
(see SimpleDateFormat)
[%$FORM_DATE_MODIFIED(<format>, <lang>)%]
Last change date of the form record. The parameter are optional. Without the paramter the date will be returned in default format. The paramter are used to determine the format and language.Example: [%$FORM_DATE_MODIFIED("yyyy/mm/dd", en-GB)%]
(see SimpleDateFormat)
System variables for HTML templates
Syntax
In addition to the system variables available to both workflow actions and templates, the following variables may be used only as part of HTML templates.
They are used for downloading attachments and are valid for the same browser session used to submit the form.
[%$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 linkText 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 no such attachment exists, these variables will not have any effect and will be removed from the rendered template.
Template variables
Syntax
A template variables takes the value of the content of a Templates and can be used by action types such as Email.
Action variables
Syntax
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, in Java as a List<Map<String,String>>. The identifier is set by the corresponding action and cannot be changed. This is used mostly by custom plugins when multiple values need to be returned.