In Targetprocess it is possible to set up workflows with constraints. For instance, you can require a user to fill in a custom field in the following cases:
- When an entity (card) is added;
- When an entity (card) is moved to a specific workflow state;
- When a specific value is selected in another custom field of an entity (card).
In these cases, you ensure that entity fields always contain required values. Blank input is prohibited.
To make a custom field required when an entity is added, please Edit the settings of Custom Fields and make the field Required.
Custom Field Constraints mashup (custom add-on) makes fields required in either of the following cases:
- Entity State Constraints: when an entity is moved to a specific workflow state;
- Custom Field Constraints: when a specific value is selected in another custom field which can be Text, Drop-Down List, or Multiple Selection List.
Custom Field Constraints mashup: usage examples
For example, you might want to make the Resolution dropdown custom field mandatory when a Bug entity is moved to the Done state. Then the mashup will require all users to select a resolution value when they mark bugs as closed.
Or, you may introduce an Approved dropdown custom field, and make the Reason for Approval text custom field required when an entity is marked as approved.
When one of these actions is triggered a user will see a popup prompt to provide a value for the required custom field:
You’re welcome to replace the default validation prompt "Please specify the following custom fields" with your custom one.
Activate and configure Custom Field Constraints mashup to support such use cases.
Setup and Activation
Configure the mashup in the Code editor area.
We recommend starting with default templates, then perform small changes on them. On each edition, perform the test in order to see how your modification affects resulting behavior of the system. Make backups of the code on each edition: it will help you to revert recent changes should you break anything in the configuration.
Perform the following changes in the code, as it is shown in the picture below:
1) Specify a Process Name, which the entity and its custom field belong to, as a ‘process:’ value.
2) Specify an Entity Type, which the custom field was created for, as a ‘constraints:’ value.
Entity Types should use origin names from Targetprocess Data Model, not customized Terms. Put names using small letters, and remove inner spaces. For example, userstory instead of User Story, request instead of Ticket etc.
3) [Optionally] Specify a Message, which will be shown in the pop-up above custom fields, as a ‘validationMessage:’ value.
When `validationMessage` is blank, the default text "Please specify the following custom fields" will be used.
A: Configure Entity State Constraints
4) Specify an Entity State, when moving to this state in the workflow the custom field will be required, as a
‘name:’ in an
5) Specify a Name of a Custom Field, which will be required, as a
‘requiredCustomFields:’ in an
In the case where multiple custom fields are required, provide a comma-separated list of custom fields.
B: Configure Custom Field Constraints
4) Specify the Name of a Custom Field, which contains the constrained value, as a
‘name:’ in a
5) Specify the Constrained value, which makes a dependent Custom Field required, as a
‘valueIn:’ in a
In case you need to make a custom field required, when any value except the specified one, is provided, use
‘valueNotIn’ instead of
Common actions in both cases
6) Click Save Mashup button.
7) After installation, reload the Targetprocess page in your web browser. Request your colleagues to perform the same action if the mashup doesn't work for them.
Compatibility. Technical Limitations
The mashup affects Quick Add forms, State selectors, Custom Fields input controls.
The mashup impacts interactions within web UI only. API requests are not affected by custom constraints.
Team Workflow states are not supported so far.
Multiple Selection List custom fields cannot be used as constrained fields when two or more values are selected simultaneously.
The mashup introduces a lot of additional checks on UI pages. It may cause a noticeable slowdown for all Targetprocess users in your company.