Activity forms
Introduction to activity forms
Activity forms are used in manual activities. They are available both in the Web Client and CM/Track. When the user clicks the activity, a form is opened and the user needs to fill out the form in order to proceed. Activity forms play an important role in the design of the workflow, as they allow to force the user to fill out certain fields in a certain step of the business process.
The forms are managed on the Activity forms page. In the workflow, they can be attached to elements which require user interaction.
Process logic with activity forms
Activity forms can be used for the following workflow elements:
-
Manual activities
-
Scope activities
-
Reopen activities
-
Manual jump-out nodes
-
Manual end nodes
The process flow is as follows:
-
The user clicks the element containing the activity form.
-
The visibility script is executed.
-
If the visibility script returns false:
-
The activity is executed without displaying the activity form.
-
-
If the visibility script returns true:
-
The initialization script is executed to prefill the activity form.
-
The user fills out the activity form.
If the form contains fields which are already filled for the current case, the user can either leave the prefilled values or modify them.
-
The activity is executed when the user saves the activity form.
If the user cancels the activity form, the activity is not executed and the case returns to the position after the previous activity.
-
-
Available settings for activity forms
The following settings are available for activity forms:
-
Path:
Read-only. The path to the activity form within the workflow. Used to reference the activity form in scripts. -
Technical name:
Mandatory. Select one of the activity forms defined in Activity forms. -
Required fields:
Optional. Select the required fields, which the user needs to fill out to be able to save the form and continue in the process. By default, all the fields are optional. This setting is made directly in the activity form, see Required fields. -
Prefill script:
Optional. Provide a script which is executed before the activity form is loaded. The script can be used to set default values in the activity form fields and modify the activity form description. -
Visibility script:
Optional. Determines whether the activity form is displayed. If the script returns true, the activity form is displayed when the user executes the activity. If it returns false, the activity form is not displayed.
All the case fields which are part of an activity form must be available in the target queue, i.e., the respective case field group must be assigned to the queue where the workflow is used. If the field group is not yet assigned to the respective queue, this is done automatically when deploying the workflow.
Best practice
Add three dots (...) to the end of the label of activities with activity forms, so that the user knows which activities open activity forms.
Tasks
Hiding fields until they are filled in a form
Activity forms are often used to keep case data concise by displaying certain fields only when they are needed in the process. The respective field groups are hidden at the beginning. Once they have been filled out in an activity form, they are shown in the case data. This avoids overwhelming the users with a huge number of fields which are not relevant at the given process stage.
Please proceed as follows to implement such a behavior:
-
Set the desired field group to Visible with the value false.
-
Create an activity form with the field group.
-
Change the visibility of the field group in the script of the activity which the form belongs to:
workflowApi.setGroupProperty("field group",GroupPropertyType.VISIBLE,"true")
Changing the form description
You can modify the description of the activity form, which is set on the Activity forms page, in the prefill script. This allows to adapt the description to the data of the current case, and to format the description to provide more detailed instructions to the users. The description can be retrieved from a text template and may contain images.
Use the following code:
controlForm.setCustomDescription(templateService.mergeAndInlineImages("template name", engineerService.getCurrentLocale(), ticket.name))
For CM/Track, you need to use RequestLocale.get() for retrieving the user’s locale.