Hide last authors
gru 1.1 1 {{content/}}
2
sas 68.3 3 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>>doc:Formcycle.UserInterface.FilesAndTemplates.WebHome]], most settings of [[actions>>doc:Formcycle.UserInterface.MyForms.WorkflowProcessing.Actions.WebHome]] and [[data base queries>>Formcycle.UserInterface.Data.DBQueries.WebHome]].
gru 1.1 4
sas 68.3 5 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.
gru 1.1 6
sas 68.3 7 == Using variables ==
8
9 {{figure image="1_en_VariablesEmail.png" group="platzhalter"}}
10 Symbol for opening a variable selection on an option field and a text field as it is used inside the action type E-mail.
gru 1.1 11 {{/figure}}
12
sas 68.3 13 {{figure image="2_en_Variables.png" group="platzhalter"}}
14 The variable selection menu. Here you can select the form field whose value is to be used.
gru 1.1 15 {{/figure}}
16
sas 68.3 17 === Using variables for actions ===
gru 1.1 18
sas 68.3 19 Form fields can be selected by clicking on the variable icon to the right of each action setting supporting variables.
gru 15.2 20
sas 68.3 21 === Using variables for templates ===
gru 1.1 22
sas 68.3 23 {{figure image="3_en_VariablesTemplates.png" group="platzhalter"}}
24 Variables may be used for templates as well. The button //Variables// at the bottom opens the variable selection menu.
gru 1.1 25 {{/figure}}
26
sas 68.3 27 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//.
gru 1.1 28
sas 68.3 29 == Variable types ==
gru 1.1 30
sas 68.2 31 {{id name="sec_form_placeholder"/}}
sas 68.1 32
sas 68.3 33 === Form elements ===
gru 1.1 34
35 {{panel monospace="true" title="Syntax"}}
sas 68.3 36 [%<FormFieldName>%]
gru 1.1 37 {{/panel}}
38
sas 68.3 39 This variable takes the value of the form field with the specified name. They are used mainly for actions such as [[Email>>doc:Formcycle.UserInterface.MyForms.WorkflowProcessing.Actions.EMail]], [[Create text file>>doc:Formcycle.UserInterface.MyForms.WorkflowProcessing.Actions.WriteTextFile]], [[Database query>>doc:Formcycle.UserInterface.MyForms.WorkflowProcessing.Actions.SQLStatement]] as well as for [[Templates>>doc:Formcycle.UserInterface.MyForms.WorkflowProcessing.Actions.ResponsePage]].
gru 1.1 40
sas 68.3 41 Example: The variable {{code language="none"}}[%tfEmail%]{{/code}} will take the value of the [[input field>>doc:Formcycle.FormDesigner.FormElements.Input]] named //tfEmail//.
gru 1.1 42
sas 68.3 43 === Special form elements ===
gru 1.1 44
sas 68.3 45 There are some special variables available:
gru 1.1 46
awa 44.12 47 ; [%xf-action%]
sas 68.3 48 : 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).
awa 44.12 49 ; [%lang%]
sas 68.3 50 : Refers to the language of the form when it was filled out, eg. //de//, //de-CH//, //en//, or //fr-FR//.
gru 1.1 51
sas 68.3 52 === System variables ===
gru 1.1 53
54 {{panel monospace="true" title="Syntax"}}
awa 44.12 55 [%$<Name>%]
gru 1.1 56 {{/panel}}
57
sas 68.3 58 System variables take the value of the corresponding system value. The following system variables are available for actions and templates:
gru 1.1 59
awa 44.8 60 ; [%$CLIENT_ID%]
sas 68.3 61 : The client ID of the client of the current form.
awa 44.8 62 ; [%$FORM_LINK%]
sas 68.3 63 : The URL of the current form.
awa 44.8 64 ; [%$FORM_PROCESS_LINK%]
sas 68.3 65 : The URL of the current form for the current process.
awa 44.8 66 ; [%$FORM_VERIFY_LINK%]
sas 68.3 67 : The URL to confirm Double opt in. Can only be used once.
awa 44.8 68 ; [%$FORM_INBOX_NAME%]
sas 68.3 69 : {{version major="6" minor="1"/}}Returns the inbox name the form record currently resides in.
awa 44.8 70 ; [%$PROCESS_ID%]
sas 68.3 71 : The current process ID of the form record.
72 ; [%$PROJECT_ALIAS%]"}}
73 : The alias of the current form.
awa 44.8 74 ; [%$PROJECT_ID%]
sas 68.3 75 : The form ID of the current form.
awa 44.8 76 ; [%$PROJECT_NAME%]
sas 68.3 77 : The name of the current form.
awa 44.8 78 ; [%$RECORD_ID%]
sas 68.3 79 : The ID of the current form record.
awa 44.8 80 ; [%$SOURCE_SERVER%]
sas 68.3 81 : The name of the server that has provided the current form, either the name of the {{fserver/}} or the local server.
awa 44.8 82 ; [%$SOURCE_SERVER_URL%]
sas 68.3 83 : The URL of the server that has provided the current form, either the name of the {{fserver/}} or the local server.
awa 44.8 84 ; [%$STATUS_ID%]
sas 68.3 85 : The ID of the current state.
awa 44.8 86 ; [%$STATUS_NAME%]
sas 68.3 87 : The name of the current state.
gru 1.1 88
sas 68.3 89 ==== System variables with parameters ====
nlo 52.1 90
91 {{panel monospace="true" title="Syntax"}}
92 [%$<Name>(<Parameter>...)%]
93 {{/panel}}
94
95 ; [%$DATE("<format>", <lang>)%]
sas 68.3 96 : {{version major="6" minor="0" patch="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>>https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html]] for more info on the date format string. The second parameter specifies the language, which affects the names of weekdays and months. Example: {{code language="none"}}[%$DATE("yyyy/MM/dd", en-GB)%]{{/code}}
nlo 52.1 97 ; [%$FORM_DATE_CREATED("<format>", <lang>)%]
sas 68.3 98 : {{version major="6" minor="0" patch="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>>https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html]] for more info on the date format string. The second parameter specifies the language, which affects the names of weekdays and months. Example: {{code language="none"}}[%$FORM_DATE_CREATED("yyyy/MM/dd", en-GB)%]{{/code}}
nlo 52.1 99 ; [%$FORM_DATE_MODIFIED("<format>", <lang>)%]
sas 68.3 100 : {{version major="6" minor="0" patch="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>>https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html]] for more info on the date format string. The second parameter specifies the language, which affects the names of weekdays and months. Example: {{code language="none"}}[%$FORM_DATE_MODIFIED("yyyy/MM/dd", en-GB)%]{{/code}}
nlo 52.1 101
sas 68.1 102 {{id name="sec_user_variables"/}}
nlo 53.4 103
sas 68.3 104 === User variables {{version major="6" minor="4" patch="0"/}} ===
nlo 52.1 105
nlo 59.2 106 {{id name="fig_prefill_user_variables"/}}
sas 68.3 107 {{figure image="prefill_user_variables_en.png"}}Using user variables to prefill form fields with data of the logged in user.{{/figure}}
nlo 59.2 108
sas 68.1 109
110 {{html wiki="true"}}
sas 68.3 111 <div class='xm-figure xm-float-right xm-clear-h2' data-alt='Using user variables to prefill form fields with data of the logged in user.'><div class='xm-figure-inner' style='width:310px'>{{lightbox image='prefill_user_variables_en.png' width='300' group='$height' group='$group' title='Using user variables to prefill form fields with data of the logged in user.'/}}<div class='xm-figure-caption'>Using user variables to prefill form fields with data of the logged in user.</div></div></div>
sas 68.1 112 {{/html}}
113
114
sas 68.3 115 User variables may be used in [[actions>>doc:Formcycle.UserInterface.MyForms.WorkflowProcessing.Actions.WebHome]], [[templates>>doc:Formcycle.UserInterface.FilesAndTemplates.WebHome]], [[data base queries>>Formcycle.UserInterface.Data.DBQueries.WebHome]] or directly in [[form elements>>Formcycle.FormDesigner.FormElements.WebHome]] for prefilling the form (see [[figure>>||anchor="fig_prefill_user_variables"]]).
nlo 54.1 116
nlo 45.2 117 {{panel monospace="true" title="Syntax"}}
sas 68.3 118 [%$&lt;user object&gt;.&lt;attribute&gt;%]
nlo 45.2 119 {{/panel}}
nlo 45.1 120
sas 68.3 121 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>>https://de.wikipedia.org/wiki/JavaScript_Object_Notation]] format.
nlo 48.1 122
sas 68.3 123 For sensible use of the user variables it is necessary to enable [[form login>>doc:Formcycle.UserInterface.MyForms.Access.WebHome||anchor="form_login"]]. If this is not configured the user object will be set to an anonymous user.
nlo 49.1 124
nlo 45.1 125
sas 68.3 126 ==== User objects ====
127
nlo 46.2 128 ; [%$USER%]
sas 68.3 129 : User object for accessing the current user.
nlo 46.2 130
131 ; [%$LAST_USER%]
sas 68.3 132 : User object for accessing the last user.
nlo 46.2 133
134 ; [%$INITIAL_USER%]
sas 68.3 135 : User object for accessing the user that submitted the form.
nlo 46.2 136
sas 68.3 137 ==== Attributes ====
nlo 48.1 138
sas 68.3 139 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>>doc:Formcycle.UserInterface.UserSettings.ExternalUsers.WebHome]] being used for logging into the form.
nlo 49.1 140
sas 68.3 141 Example: The user variable **[%$USER.mail%]** returns the email address of the user that has logged into the form.
nlo 51.1 142
143 ; authTypeId
sas 68.3 144 : ID of the [[authenticator>>doc:Formcycle.UserInterface.UserSettings.ExternalUsers.WebHome]] the user chose for login.
nlo 51.1 145 ; displayName
sas 68.3 146 : Display name of the user
nlo 51.1 147 ; familyName
sas 68.3 148 : Family name of the user
nlo 57.1 149 ; firstName
sas 68.3 150 : First name of the user
nlo 51.1 151 ; gender
sas 68.3 152 : Gender of the user
nlo 51.1 153 ; groups
sas 68.3 154 : Group names of the user
nlo 51.1 155 ; id
sas 68.3 156 : ID of the user. (system ID for FORMCYCLE users)
nlo 51.1 157 ; linkedId
sas 68.3 158 : A user profile may have a linked identifier, which is the identifier of another user profile.
nlo 51.1 159 ; locale
sas 68.3 160 : Language of the user
nlo 51.1 161 ; location
sas 68.3 162 : Location of the user
nlo 51.1 163 ; mail
sas 68.3 164 : email address of the user
nlo 51.1 165 ; phone
sas 68.3 166 : phone number of the user
nlo 51.1 167 ; pictureUrl
sas 68.3 168 : URL to the profile picture of the user
nlo 51.1 169 ; profileUrl
sas 68.3 170 : URL to the profile of the user
nlo 51.1 171 ; rawData
sas 68.3 172 : All the information about the user in a [[JSON>>https://de.wikipedia.org/wiki/JavaScript_Object_Notation]] format. Depending on the chosen authenticator, the raw data may include additional information about the user that can otherwise not be accessed through attributes.
nlo 51.1 173 ; role
sas 68.3 174 : Role of the user
nlo 51.1 175 ; title
sas 68.3 176 : Title of the user
nlo 51.1 177 ; typedId
sas 68.3 178 : Type of the [[authenticator>>doc:Formcycle.UserInterface.UserSettings.ExternalUsers.WebHome]] the user chose for login.
nlo 51.1 179 ; userName
sas 68.3 180 : user name
nlo 51.1 181
sas 68.1 182 {{id name="sec_appointment_variables"/}}
183
sas 68.3 184 === Appointment variables {{version major="6" minor="5" patch="0"/}} ===
nlo 64.1 185
sas 68.3 186 Appointment variables can be used when [[appointments>>doc:Formcycle.FormDesigner.FormElements.Appointment.WebHome]] are booked with the form.
nlo 67.1 187
nlo 66.1 188 {{panel monospace="true" title="Syntax"}}
189 [%$&lt;Name&gt;%]
190 {{/panel}}
191
nlo 64.1 192 ; [%$APPOINTMENT_LIST%]
sas 68.3 193 : 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.
nlo 64.1 194 ; [%$APPOINTMENT_LINK%]
sas 68.3 195 : Creates a link to an iCal file that contains all the dates of the form record.
nlo 64.1 196
sas 68.2 197 {{id name="sec_system_placeholder_html"/}}
sas 68.1 198
sas 68.3 199 === System variables for HTML templates ===
gru 1.1 200
201 {{panel monospace="true" title="Syntax"}}
awa 44.11 202 [%$&lt;Name&gt;(&lt;Parameter1&gt;,&lt;Parameter2&gt;)%]
gru 1.1 203 {{/panel}}
204
sas 68.3 205 In addition to the system variables available to both workflow actions and templates, the following variables can be used only in [[HTML templates>>doc:Formcycle.UserInterface.FilesAndTemplates.HTML.WebHome]]. They are used for downloading attachments and are valid for the same browser session that was active when the form was submitted.
gru 1.1 206
awa 44.11 207 ; [%$ATTACHMENT_LIST%]
sas 68.3 208 : Inserts a list with all available attachments that can be downloaded. This will create an //ul// element.
209 ; [%$ATTACHMENT_ZIP=fileName,linkText%]
210 : 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:
211 :; [%$ATTACHMENT_ZIP=fileName,linkText%]
212 :: Creates a link with the text //linkText// for downloading all attachements a zip archive that will be named //fileName//.
213 :; [%$ATTACHMENT_ZIP=fileName%]
214 :: Creates a link with the text //fileName// for dowloading all attachments a zip file that will be named //fileName//.
awa 44.11 215 :; [%$ATTACHMENT_ZIP%]
sas 68.3 216 :: Creates a link with the text {{code language="none"}}attachment.zip{{/code}} for downloading all attachements as a zip file named {{code language="none"}}attachment.zip{{/code}}.
217 ; [%$ATTACHMENT=attachmentName,linkText,fileName%]
218 : 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:
219 :; [%$ATTACHMENT=attachmentName,linkText,fileName%]
220 :: Creates a link with the text //linkText// for downloading a single attachment with the name //attachmentName// as a file named //fileName//.
221 :; [%$ATTACHMENT=attachmentName,linkText%]
222 :: Creates a link with the text //linkText// for an attachment with the name //attachmentName//.
223 :; [%$ATTACHMENT=attachmentName%]
224 :: Creates a link for downloading an attachment with the name //attachmentName//.
gru 1.1 225
sas 68.3 226 When the specified attachment does not exist, these variables will not have any effect and will be removed from the rendered HTML template.
gru 1.1 227
sas 68.3 228 === Template variables ===
gru 1.1 229
230 {{panel monospace="true" title="Syntax"}}
awa 44.11 231 [%$$&lt;Name&gt;%]
gru 1.1 232 {{/panel}}
233
sas 68.3 234 A template variables takes the value of the content of a [[template>>doc:Formcycle.UserInterface.FilesAndTemplates.WebHome]] (for example [[text>>doc:Formcycle.UserInterface.FilesAndTemplates.Text]], [[email>>doc:Formcycle.UserInterface.FilesAndTemplates.Email]], or [[link>>doc:Formcycle.UserInterface.FilesAndTemplates.Link]]) and can be used by workflow action such as [[Email>>doc:Formcycle.UserInterface.MyForms.WorkflowProcessing.Actions.EMail]].
gru 1.1 235
sas 68.3 236 === Action variables ===
gru 1.1 237
238 {{panel monospace="true" title="Syntax"}}
sas 68.3 239 [%$&lt;actionName&gt;.&lt;returnValue&gt;%]
gru 1.1 240 {{/panel}}
241
sas 68.3 242 Some actions have got return values that can accessed by action variables.
gru 1.1 243
sas 68.3 244 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.
gru 1.1 245
sas 68.3 246 ; [%$<actionName>.SUCCESS%]
247 : Whether the action could be processed successfully. Evaluates to a boolean, ie. true or false.
248 ; [%$<actionName>.COUNT%]
249 : The number of results. Evaluates to an integer value.
250 ; [%$<actionName>.RESULT%]
251 : A single return value. Evaluates to a string value.
252 ; [%$<actionName>.RESULT[<Index>].<Identifier>%]
253 : 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.
Copyright 2000-2024