Show last authors
1 {{content/}}
2
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]].
4
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.
6
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.
11 {{/figure}}
12
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.
15 {{/figure}}
16
17 === Using variables for actions ===
18
19 Form fields can be selected by clicking on the variable icon to the right of each action setting supporting variables.
20
21 === Using variables for templates ===
22
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.
25 {{/figure}}
26
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//.
28
29 == Variable types ==
30
31 {{id name="sec_form_placeholder"/}}
32
33 === Form elements ===
34
35 {{panel monospace="true" title="Syntax"}}
36 [%<FormFieldName>%]
37 {{/panel}}
38
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]].
40
41 Example: The variable {{code language="none"}}[%tfEmail%]{{/code}} will take the value of the [[input field>>doc:Formcycle.FormDesigner.FormElements.Input]] named //tfEmail//.
42
43 === Special form elements ===
44
45 There are some special variables available:
46
47 ; [%xf-action%]
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).
49 ; [%lang%]
50 : Refers to the language of the form when it was filled out, eg. //de//, //de-CH//, //en//, or //fr-FR//.
51
52 === System variables ===
53
54 {{panel monospace="true" title="Syntax"}}
55 [%$<Name>%]
56 {{/panel}}
57
58 System variables take the value of the corresponding system value. The following system variables are available for actions and templates:
59
60 ; [%$CLIENT_ID%]
61 : The client ID of the client of the current form.
62 ; [%$FORM_LINK%]
63 : The URL of the current form.
64 ; [%$FORM_PROCESS_LINK%]
65 : The URL of the current form for the current process.
66 ; [%$FORM_VERIFY_LINK%]
67 : The URL to confirm Double opt in. Can only be used once.
68 ; [%$FORM_INBOX_NAME%]
69 : {{version major="6" minor="1"/}}Returns the inbox name the form record currently resides in.
70 ; [%$PROCESS_ID%]
71 : The current process ID of the form record.
72 ; [%$PROJECT_ALIAS%]"}}
73 : The alias of the current form.
74 ; [%$PROJECT_ID%]
75 : The form ID of the current form.
76 ; [%$PROJECT_NAME%]
77 : The name of the current form.
78 ; [%$RECORD_ID%]
79 : The ID of the current form record.
80 ; [%$SOURCE_SERVER%]
81 : The name of the server that has provided the current form, either the name of the {{fserver/}} or the local server.
82 ; [%$SOURCE_SERVER_URL%]
83 : The URL of the server that has provided the current form, either the name of the {{fserver/}} or the local server.
84 ; [%$STATUS_ID%]
85 : The ID of the current state.
86 ; [%$STATUS_NAME%]
87 : The name of the current state.
88
89 ==== System variables with parameters ====
90
91 {{panel monospace="true" title="Syntax"}}
92 [%$<Name>(<Parameter>...)%]
93 {{/panel}}
94
95 ; [%$DATE("<format>", <lang>)%]
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}}
97 ; [%$FORM_DATE_CREATED("<format>", <lang>)%]
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}}
99 ; [%$FORM_DATE_MODIFIED("<format>", <lang>)%]
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}}
101
102 {{id name="sec_user_variables"/}}
103
104 === User variables {{version major="6" minor="4" patch="0"/}} ===
105
106 {{id name="fig_prefill_user_variables"/}}
107 {{figure image="prefill_user_variables_en.png"}}Using user variables to prefill form fields with data of the logged in user.{{/figure}}
108
109
110 {{html wiki="true"}}
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>
112 {{/html}}
113
114
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"]]).
116
117 {{panel monospace="true" title="Syntax"}}
118 [%$&lt;user object&gt;.&lt;attribute&gt;%]
119 {{/panel}}
120
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.
122
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.
124
125
126 ==== User objects ====
127
128 ; [%$USER%]
129 : User object for accessing the current user.
130
131 ; [%$LAST_USER%]
132 : User object for accessing the last user.
133
134 ; [%$INITIAL_USER%]
135 : User object for accessing the user that submitted the form.
136
137 ==== Attributes ====
138
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.
140
141 Example: The user variable **[%$USER.mail%]** returns the email address of the user that has logged into the form.
142
143 ; authTypeId
144 : ID of the [[authenticator>>doc:Formcycle.UserInterface.UserSettings.ExternalUsers.WebHome]] the user chose for login.
145 ; displayName
146 : Display name of the user
147 ; familyName
148 : Family name of the user
149 ; firstName
150 : First name of the user
151 ; gender
152 : Gender of the user
153 ; groups
154 : Group names of the user
155 ; id
156 : ID of the user. (system ID for FORMCYCLE users)
157 ; linkedId
158 : A user profile may have a linked identifier, which is the identifier of another user profile.
159 ; locale
160 : Language of the user
161 ; location
162 : Location of the user
163 ; mail
164 : email address of the user
165 ; phone
166 : phone number of the user
167 ; pictureUrl
168 : URL to the profile picture of the user
169 ; profileUrl
170 : URL to the profile of the user
171 ; rawData
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.
173 ; role
174 : Role of the user
175 ; title
176 : Title of the user
177 ; typedId
178 : Type of the [[authenticator>>doc:Formcycle.UserInterface.UserSettings.ExternalUsers.WebHome]] the user chose for login.
179 ; userName
180 : user name
181
182 {{id name="sec_appointment_variables"/}}
183
184 === Appointment variables {{version major="6" minor="5" patch="0"/}} ===
185
186 Appointment variables can be used when [[appointments>>doc:Formcycle.FormDesigner.FormElements.Appointment.WebHome]] are booked with the form.
187
188 {{panel monospace="true" title="Syntax"}}
189 [%$&lt;Name&gt;%]
190 {{/panel}}
191
192 ; [%$APPOINTMENT_LIST%]
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.
194 ; [%$APPOINTMENT_LINK%]
195 : Creates a link to an iCal file that contains all the dates of the form record.
196
197 {{id name="sec_system_placeholder_html"/}}
198
199 === System variables for HTML templates ===
200
201 {{panel monospace="true" title="Syntax"}}
202 [%$&lt;Name&gt;(&lt;Parameter1&gt;,&lt;Parameter2&gt;)%]
203 {{/panel}}
204
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.
206
207 ; [%$ATTACHMENT_LIST%]
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//.
215 :; [%$ATTACHMENT_ZIP%]
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//.
225
226 When the specified attachment does not exist, these variables will not have any effect and will be removed from the rendered HTML template.
227
228 === Template variables ===
229
230 {{panel monospace="true" title="Syntax"}}
231 [%$$&lt;Name&gt;%]
232 {{/panel}}
233
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]].
235
236 === Action variables ===
237
238 {{panel monospace="true" title="Syntax"}}
239 [%$&lt;actionName&gt;.&lt;returnValue&gt;%]
240 {{/panel}}
241
242 Some actions have got return values that can accessed by action variables.
243
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.
245
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