If important issue updates occur outside of status changes, you cannot validate field entries using workflow Validators. That's where our powerful Event-based Actions come in. It offers a collection of triggers that will kick off one or more of JMWE's post functions to automate processes outside of workflows. One of its triggers - Issue Field Value Change - will trigger an action when an issue field value changes.
When a user edits an issue, validate field value input - if it's wrong, show the message and roll back to the previous value.
Viewing time 2 min 30 sec
For your convenience, the steps from the above video have been outlined below.
When a user edits an issue, validate the field value input.
Here is how to validate input when a user changes a field, and display an in-app message when the input doesn't follow the required format to alert the user. Even better - automatically revert to the previous value.
- Go to Event-based Actions in the JMWE App administration.
- Click on "New event-based action" to create this automation.
- Give it a name, such as "Check value of man hours."
- In the Event trigger, select "Issue Field Value Changed."
- In Fields to monitor, select "Man hours" field to watch for changes and to validate.
- Optional: Select any one or more Projects to apply this to. Leave blank if this applies to all projects globally.
- Optional: You can also select issue types to which this action will apply.
- In the Scope section, add conditional execution by checking "Only apply to issues that match a Nunjucks condition."
- In the "Nunjucks condition" field, navigate to and expand the "Issue Fields" tab, select "Man hours" in the field dropdown.
- Referred to the field either by Name or ID, click on it to select and insert the proper field - issue.fields["Man hours"] - into the value section. We suggest using field IDs instead of names in case the name is edited in the future.
- In the "Nunjucks condition" section, add >10 (to represent "greater than 10") after the name or ID of the field.
- Press "Add post function." We'll configure a post function to display an "error" message to users if the field value entered is greater than 10.
- Add "Display Message to User" post-function.
- Input information you want to appear to users if the "Man hours" field entry is greater than 10.
- Optional: select message type "Warning" and check "Automatically close message."
- Save the post function.
- Again, "Add post function". We'll configure a post function to roll back the field to the previous value.
- Select the "Set field value" post function, and configure it.
- Select Field "Man hours."
- Type the following Nunjucks expression into the Value field:
{{issue | fieldHistory( "Man hours" ) | last | field("from_strong")}}
This will set the previous field value. You can find all these snippets of code in our documentation.
- Press "Save" to save the post function.
- Press "Save" to save the Event-based Action.
- All done.
See it all in action in the video above.