Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can an automation send an error message to the user as an action?

Phil Bustin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 2, 2023

Can an automation that currently creates a sub-task if a checkbox equals a value, to instead send an error message to the user if a related field is empty?  I don't see any action that looks like that.

The broader question is, is there a way of accomplishing this function?  As I think about it, the automation can of course simply not create the sub-task if the related field isn't empty, but the user needs to see an error message.

3 answers

3 accepted

0 votes
Answer accepted
Darryl Lee
Community Champion
June 2, 2023

Yeah, the main issue here is that Jira Automation cannot display error messages or prevent actions from happening.

The "standard" way to do this is with a validator, and but in your case, you will need a Custom Validator. You've mention two different scenarios:

  • Can an automation that currently creates a sub-task if a checkbox equals a value, to instead send an error message to the user if a related field is empty?  I don't see any action that looks like that.
  • I can't unconditionally require field B, since it's only required if field A contains a specific value.

So you would have a custom validator that says:

  • If field A is not empty, then field B is required.
  • And validators have the ability to put up a custom error message.

Unfortunately custom validators require a paid third-party app, and you might have to learn a little bit about Jira Expressions. 

In this case it would be something like:

!!issue.customfield_20001.value && !!issue.customfield_20002.value

(I modified an example from Use cases for validators.)

0 votes
Answer accepted
Manoj Gangwar
Community Champion
June 2, 2023

Hi @Phil Bustin ,

In that case, You can add the workflow field required Validator on the create issue Transition. Make the field required and add a error message. 

Go the workflow>>edit >>click on create transition>>click on validator>>Select Field required validator>>Add the field & error message which you want.

Phil Bustin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 2, 2023

Thank you Manoj, but I think this is not the answer.  To clarify, I can't unconditionally require field B, since it's only required if field A contains a specific value.

Manoj Gangwar
Community Champion
June 2, 2023

If you have JWT Plugin then you can use the "Validation based on JQL query".

Phil Bustin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 2, 2023

I would have to ask for our first plugin.

Like Manoj Gangwar likes this
0 votes
Answer accepted
Mikael Sandberg
Community Champion
June 2, 2023

Yes, as you mentioned you can just not create the sub-task if the field isn't empty and in that case notify the user the reason why the sub-task was not created.

Phil Bustin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 2, 2023

But notify how--add a comment?

Mikael Sandberg
Community Champion
June 2, 2023

Either by adding a comment to the trigger issue, or you have the option to send an email, or sending them a slack message if you are syncing the Slack ID to the user's property as described in this article.

Phil Bustin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 5, 2023

I'll look into that, but what I've been working on is this: 

1) Position an "Automation message" field at the top of the form.

2) Create a separate automation (to avoid too much complexity in the current one) that interrogates all 7 checkbox/text field pairs and sets a single selection field (yes or no), if a discrepancy is found.

3) Set a condition in the existing automation that will create sub-tasks only if the aforementioned single selection field (that acts as a switch) is 'no' (for no discrepancy).  Otherwise, populate the Automation message field with a message notifying the user that at least one discrepancy was found.

4) Create a validator in the transition that the switch must = 'yes'.  (Possibly I will need to set a separate switch in the existing automation, and use that for the validator, but that's just a detail.)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events