How can use validator, before create transition

Venkatesh Bhureddy
Contributor
December 11, 2019

How can use validator, before create transition? please let me know.

Transition.PNG

3 answers

1 accepted

2 votes
Answer accepted
Leonard Chew
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.
December 12, 2019

What Thorsten suggested, you can also do that with scriptrunner, you'll need to script the condition however.

I have tested it and it works:

Scripted Validator Condition:

summary-exists-script.png

 

Error Message on Screen when you have a summary that already exists (e.g. what the script checks):

summary-exists.png

Venkatesh Bhureddy
Contributor
December 12, 2019

@Leonard Chew

This is working Thanks Chew.

Like Leonard Chew likes this
Leonard Chew
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.
December 12, 2019

@Venkatesh Bhureddy , good job!

Just out of curiosity: You were able to get the "getIssuesByJQL()" function to work? Thats a custom function I wrote for more convenience, as I often use jql results in my scripts. 

2 votes
Thorsten Letschert _Decadis AG_
Atlassian Partner
December 12, 2019

Hi @Venkatesh Bhureddy ,

as mentioned before this isn't possible out of the box. However, if using an additional app is a valid option for you, you might want to have a look at Jira Workflow Toolbox

It allows you to validate against a JQL query to check if specific tickets already exist (see https://apps.decadis.net/display/JWT/Condition+and+validation+based+on+JQL+query). In your scenario, you would have to check for the custom field value.

Disclaimer: I belong to the team behind the aforementioned app.

Cheers
Thorsten

1 vote
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 11, 2019

You cannot. Validators are associated with a transition. Depending on your goal you might consider an automation or scripting addon. Maybe if you describe your requirement we could provide a solution.

Nic Brough -Adaptavist-
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.
December 11, 2019

Validators, by definition, happen after someone has tried to make a change.  They are there for checking input!

What you are looking for is more of a "condition", which is "can this be done?  If not, don't even let the process start".  When you're creating an issue, you can't do this - you don't have enough information in the workflow process. So there's nowhere to put a condition on create.

Jira does the condition before the workflow, and all it does is check the permission that a person has the right to create issues in that project.

Venkatesh Bhureddy
Contributor
December 11, 2019

Hi @Jack Brickey ,

I am trying to add validator before transition, the main purpose we can stop create issue.

 I need help trying to find a way of stopping an issue being created if there is an open issue with a custom field value selected

Example: 

Issue 1 is Open and Custom Field = 123

User tries to create Issue 2 and populates Custom Field with '123'. I want the creation to be stoppped with maybe an error message? and dont get created

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 12, 2019

This cannot be done thru a Validator as it only works on the transition and only assessing the current issue not looking a existing issues.

I’m unsure how to achieve this or if it is even possible. For sure you would require an addon. You might look at Scriptrunner, powerscripts, etc.

Like Nic Brough -Adaptavist- likes this

Suggest an answer

Log in or Sign up to answer