Joget Workflow v6
Hash Variable
http://facebook.com/jogetworkflow
http://twitter.com/jogetworkflow
Last Revised on Oct 2018
All Rights Reserved © Joget Inc
Prerequisites
• General understanding on how to design an App using
the Joget Workflow platform (i.e. Process, Form, Datalist,
Userview).
All Rights Reserved © Joget Inc
Content
1. Introduction to Hash Variable
2. List of Hash Variable and its usages
3. Nested Hash Variable
All Rights Reserved © Joget Inc
Chapter 1
Introduction to Hash Variable
All Rights Reserved © Joget Inc
What is Hash Variable?
• Hash Variable != Workflow Variable
All Rights Reserved © Joget Inc
What is Hash Variable?
• Hash Variable is a special hash-escaped keyword that can be
used in (but NOT limited to)...
– Form Builder
– Datalist Builder
– Userview Builder
– Supported plugin configuration properties
– Activity name in Workflow Designer
– External Form URL when mapping an activity to an external form
...to
return the value of useful runtime variables from the
(App) environment.
All Rights Reserved © Joget Inc
Hash Variable
• Each Hash Variable element has its own prefix. E.g.:
– #date.D-MMM-yyyy#
– #form.leave_applications.name#
– #variable.status#
– #i18n.smtpServer#
• A new Hash Variable (with it’s own unique prefix) can be
built through Joget Workflow plugin architecture.
All Rights Reserved © Joget Inc
Plugin Types
All Rights Reserved © Joget Inc
Chapter Review
• Brief understanding on the purpose that Hash Variable
serves.
All Rights Reserved © Joget Inc
Chapter 2
List of Hash Variables & its
usages
All Rights Reserved © Joget Inc
Sample use case
• How to display requestor’s full name in a form?
All Rights Reserved © Joget Inc
Sample use case
• How to display requestor’s full name in task / activity
name instead of just “Approve / Reject Request”?
for Cat Grant
All Rights Reserved © Joget Inc
List of Hash Variables
Reference:
https://dev.joget.org/community/display/KBv6/Hash+Variable
All Rights Reserved © Joget Inc
Take 10~15 minutes...
Roughly run through all the hash variables in our Joget
Community - Knowledge Base →
https://dev.joget.org/community/display/KBv6/Hash+Variable
OR
Go through slides 14 to 42 for the essentials.
Ask us about any hash variables to clarify on…
:)
All Rights Reserved © Joget Inc
Performer Hash Variable
• Performer
– To get user information of the performer of an activity.
• #performer.activityDefId.id#,
• #performer.activityDefId.username#,
• #performer.activityDefId.firstName#,
• #performer.activityDefId.lastName#,
• #performer.activityDefId.email#,
• #performer.activityDefId.active#,
• #performer.activityDefId.timeZone#
• Replace “activityDefId” with the appropriate activity definition id.
• Reference: http://dev.joget.org/community/display/KBv6/Hash+Variable#HashVariable-
PerformerHashVariable
All Rights Reserved © Joget Inc
Using #performer Hash Variable
#performer.clarification.username#
All Rights Reserved © Joget Inc
Using #performer Hash Variable in
Form Builder
Hash Variable can be
used in Section Name &
Form Element
All Rights Reserved © Joget Inc
Using #performer Hash Variable in
Workflow Designer
#performer.submitLeave.firstName#
#performer.submitLeave.lastName#
All Rights Reserved © Joget Inc
Using #performer Hash Variable in
Plugin Configuration
In Email Plugin, Hash
Variables are supported
in From, To (specific
email address), CC,
Subject and Message
fields.
All Rights Reserved © Joget Inc
Internationalization Hash Variable
• Internationalization support on application
– Support language localization on application level.
• #i18n.keyName#
• Replace “keyName” with the appropriate message key.
• Reference:
http://dev.joget.org/community/display/KBv6/Hash+Variable#HashVariable-
AppMessageHashVariable(Internationalization)
All Rights Reserved © Joget Inc
Using #i18n in Userview Builder
• The #i18n Hash Variable retrieves values from the
Message set of the App.
• E.g. Message with key app.hello in 2 locales.
All Rights Reserved © Joget Inc
Using #i18n in Userview Builder
• With the key defined, the hash variable can be used in the
Userview Builder to dynamically show corresponding value
depending on the user’s locale.
All Rights Reserved © Joget Inc
Request Parameter Hash Variable
• Request Parameter
– For accessing request parameters.
• #requestParam.parameterName#
• Replace “parameterName” with the appropriate request
parameter name.
• Reference:
http://dev.joget.org/community/display/KBv6/Hash+Variable#HashVariable-
RequestParameterHashVariable
All Rights Reserved © Joget Inc
Using #requestParam in Form Builder
• Useful to pre-populate
form field.
All Rights Reserved © Joget Inc
Environment Variable Hash Variable
• Environment Variable
– Application level environment variable is typically used to store
common or re-usable values such as Email server settings.
• #envVariable.keyName#
• Replace “keyName” with the appropriate Environment Variable
name.
• Reference:
http://dev.joget.org/community/display/KBv6/Hash+Variable#HashVariable-
EnvironmentVariableHashVariable
All Rights Reserved © Joget Inc
Using #envVariable in Email Tool
• Use Environment Variable on Email Tool to ease
maintenance.
All Rights Reserved © Joget Inc
Current User Hash Variable
• Current User
– Retrieve currently logged in user information.
• #currentUser.id#,
• #currentUser.username#,
• #currentUser.firstName#,
• #currentUser.lastName#,
• #currentUser.email#,
• #currentUser.active#,
• #currentUser.timeZone#
• Reference:
http://dev.joget.org/community/display/KBv6/Hash+Variable#HashVariable-CurrentUserHashVariable
All Rights Reserved © Joget Inc
Using #currentUser on Form Builder
• Prepopulate applicant’s name in Form
All Rights Reserved © Joget Inc
User Hash Variable
• User
– To get user information based on username.
• #user.username.id#
• #user.username.username#
• #user.username.firstName#
• #user.username.lastName#
• #user.username.email#
• #user.username.active#
• #user.username.timeZone#
• Replace “username” with the appropriate user’s username.
• Reference:
http://dev.joget.org/community/display/KBv6/Hash+Variable#HashVariable-UserHashVariable
All Rights Reserved © Joget Inc
Using #user Hash Variables
• To get user information based on the username.
Example:
#user.admin.email#
#user.cat.firstName#
#user.{form.leave_applications.username}.firstName#
#user.{form.leave_applications.username}.lastName#
This is a Nested hash variable where one can include
a hash variable inside another hash variable.
Subsequent level of hash variable is encapsulated with
a pair of curly bracket.
All Rights Reserved © Joget Inc
Assignment Hash Variable
• Assignment
– To get workflow activity information of the current assignment.
• #assignment.processId#,
• #assignment.processDefId#,
• #assignment.processName#,
• #assignment.processVersion#,
• #assignment.processRequesterId#,
• #assignment.description#,
• #assignment.activityId#,
• #assignment.activityName#,
• #assignment.activityDefId#,
• #assignment.assigneeId#
• Reference:
http://dev.joget.org/community/display/KBv6/Hash+Variable#HashVariable-
WorkflowAssignmentHashVariable
All Rights Reserved © Joget Inc
Using #assignment on Form Builder
• Retrieve current assignment information.
All Rights Reserved © Joget Inc
Form Hash Variable
• Form
– To get data from form table.
– #form.formDataTableName.fieldId#
• Replace “formDataTableName”
and “fieldId”
with the appropriate table name
and field id.
• #form.leave_applications.start_date#
• Reference:
http://dev.joget.org/community/display/KBv6/Hash+Variable#HashVariable-FormDataHashVariable
All Rights Reserved © Joget Inc
Using #form in Email Tool / Plugin
Configuration
Format: #form.formDataTableName.fieldId#
• Examples:
• #form.leave_applications.name#
• #form.leave_applications.start_date#
• #form.leave_applications.approval[0001]#
– To retrieve the field value by specifying a specific record primary key value,
0001.
• #form.leave_applications.approval[{variable.recordId}]# //using nested
Hash Variable with curly bracket.
– To achieve the same result like the previous point but by making reference
to another Hash Variable for its record primary key value.
All Rights Reserved © Joget Inc
Using #form in Email Tool / Plugin
Configuration
All Rights Reserved © Joget Inc
Workflow Variable Hash Variable
• Workflow Variable
– To get the value of a workflow variable.
• #variable.variableName#
• Replace “variableName” with the appropriate workflow variable
name.
• Reference:
http://dev.joget.org/community/display/KBv6/Hash+Variable#HashVariable-WorkflowVariableHashVariable
All Rights Reserved © Joget Inc
Using #variable Hash Variable
• To get the value of a workflow variable.
Example: #variable.status#
All Rights Reserved © Joget Inc
Date Hash Variable
• Date
– To get date time according to a specified format.
• #date.dateFormat#
• #date.[DAY/MONTH/YEAR][+/-]IntegerValue.dateFormat#
– Examples:
• #date.h:mm a# will produce
12:08 PM
• #date.EEE, d MMM yyyy h:mm:ss a# will produce
Wed, 4 Jul 2009 12:08:56 PM
• Replace “dateFormat” with the appropriate keyword
documented in SimpleDateFormat class
http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
• Reference:
http://dev.joget.org/community/display/KBv6/Hash+Variable#HashVariable-DateHashVariable
All Rights Reserved © Joget Inc
Using #date Hash Variables
• Source:
http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
Letter Date or Time Component Presentation Examples
G Era designator Text AD
y Year Year 1996; 96
M Month in year Month July; Jul; 07
w Week in year Number 27
W Week in month Number 2
D Day in year Number 189
d Day in month Number 10
F Day of week in month Number 2
E Day in week Text Tuesday; Tue
a Am/pm marker Text PM
H Hour in day (0-23) Number 0
k Hour in day (1-24) Number 24
K Hour in am/pm (0-11) Number 0
h Hour in am/pm (1-12) Number 12
m Minute in hour Number 30
s Second in minute Number 55
S Millisecond Number 978
Pacific Standard
z Time zone General time zone
Time; PST; GMT-08:00
Z Time zone RFC 822 time zone -0800
All Rights Reserved © Joget Inc
Using #date Hash Variables
• Example: #date.EEE, d MMM yyyy h:mm:ss a#
Java SimpleDateFormat
• Sample Output: Mon, 28 Dec 2009 11:27:26 AM
All Rights Reserved © Joget Inc
Using #date Hash Variables
• Example: #date.DAY+7.EEE, d MMM yyyy h:mm:ss a#
+7 days Java SimpleDateFormat
• Sample Output: Mon, 4 Jan 2010 11:27:26 AM
All Rights Reserved © Joget Inc
Using #date Hash Variables
• Example: #date.MONTH-2.EEE, d MMM yyyy h:mm:ss a#
-2 months Java SimpleDateFormat
• Sample Output: Wed, 28 Oct 2009 11:27:26 AM
All Rights Reserved © Joget Inc
Using #date Hash Variables
• Example: #date.YEAR+1.EEE, d MMM yyyy h:mm:ss a#
+1 year Java SimpleDateFormat
• Sample Output: Tue, 28 Dec 2010 11:27:26 AM
All Rights Reserved © Joget Inc
Hash Variable assistant/autocomplete
• Use CTRL+SHIFT+3 ( CTRL + # ) to open up the
autocomplete to help you with hash variable.
All Rights Reserved © Joget Inc
Chapter Review
• Appreciate the flexibility and convenience brought by the
Hash Variable.
• Able to apply the Hash Variable feature into application
development.
All Rights Reserved © Joget Inc
Chapter 3
Nested Hash Variable
All Rights Reserved © Joget Inc
Nested Hash Variable
• Hash Variable can be used inside another Hash Variable
to form a Nested Hash Variable.
• The syntax for the inner and subsequent Hash Variables is
wrapped by a pair of curly bracket '{' and '}' instead of the
usual pair of #.
• Example: #prefix.{prefix.variableKey}#
• There is no limit to the depth of the nested variable.
All Rights Reserved © Joget Inc
Example of Nested Hash Variable
• #date.{envVariable.dateFormat}#
• #user.{variable.username}.firstName#
• #form.tableChild.field1[{form.tableParent.childId}]#
All Rights Reserved © Joget Inc
Chapter Review
• Appreciate the flexibility and convenience brought by the
Hash Variable.
• Able to apply the Hash Variable feature into application
development.
All Rights Reserved © Joget Inc
Exercise 1
In “Submit Request” form, pre-populate the applicant’s
name using hash variable.
All Rights Reserved © Joget Inc
Exercise 2
In “Notify Rejected Request” Email Tool, compose the
message as the following using hash variable.
Go through the process flow to send out the test email.
Dear [applicant name],
Your request has been [status] due to the following reason:-
[rejected reason]
Thank you.
All Rights Reserved © Joget Inc
Exercise 3
In Inbox, instead of just showing “Approve / Reject
Request”, include the applicant’s name to the example as
follow:-
All Rights Reserved © Joget Inc
Exercise 4
Create a new request list that will only show requests that
are submitted by the current logged in user.
▪ Create a new Datalist
Add filter criteria in “Extra Filter Condition”.
– E.g. ( e.customProperties.name = 'Cat Grant' )
– Replace 'Cat Grant' with the appropriate Hash Variable
▪ Add the created list into the existing Userview
Reference:
http://dev.joget.org/community/display/KBv6/Form+Data+Binder
All Rights Reserved © Joget Inc
Exercise 5 - Optional
Make use of Environment Variable to store commonly used
settings or attributes
-e.g. Branding in (more than one) form/page.
-e.g. (Repetitive but same) Email configuration used in Email
Tool plugin.
Reference:
http://dev.joget.org/community/display/KBv6/Environment+Variable
All Rights Reserved © Joget Inc
Exercise 5 - Optional
Branding in (more than one) form/page.
All Rights Reserved © Joget Inc
Exercise 5 - Optional
Branding in (more than one) form/page.
In the form design, create a CUSTOM HTML, use hash
variable to obtain the environment variable value.
All Rights Reserved © Joget Inc
Discussion
• When will the hash variables be parsed?
• Can end user write hash variable when submitting form?
• Can we develop a new hash variable plugin?
• Can we have redundant hash variable prefix?
All Rights Reserved © Joget Inc
Module Review
1. Introduction to Hash Variable
2. List of Hash Variable and its usages
3. Nested Hash Variable
All Rights Reserved © Joget Inc
Stay Connected with Joget Workflow
• www.joget.org
• community.joget.org
• twitter.com/jogetworkflow
• facebook.com/jogetworkflow
• youtube.com/jogetworkflow
All Rights Reserved © Joget Inc