Need to create global validator on create

Pierre Ibrahim February 21, 2024

Hello all,

I'm trying to create a validator on all issue types that would run on create, however if there's a way for me to avoid adding the validator to each issue type's workflow, that'd be ideal.

I'm using JWT for the validator, using the Logical validator with the following condition:

Jira Validator.png

And this is the text for the condition:

(count(issuesFromJQL("project = " + %{issue.project.key} + " and issuetype = 'Client Project' and 'Client Project Type' = Implementation and resolution is EMPTY")) = 1 and %{issue.cf17201} = "Yes") 
OR (count(issuesFromJQL("project = " + %{issue.project.key} + " and issuetype = 'Client Project' and 'Client Project Type' = Implementation and resolution is EMPTY")) = 0 and (%{issue.cf17201} = "No" or %{issue.cf17201} = ""))

All it's doing really is checking the project the ticket is getting created in, if it has a specific issue, a field needs to have its value set to Yes, otherwise it can be No or Blank. This works great as an on create validator on one workflow. But I'm wondering if there's a way I can scale this to be across any issue created without having to add the validator on each individual workflow.

I looked at JWT's automation and I couldn't achieve what I need, and I don't believe native JIRA automation would achieve it either since the issue needs to have been created for something to happen (or an event fired, etc...)

Would a scriptrunner listener work for something like this? Does JWT have this functionality already and I just don't know where it is?

Any help or guidance is greatly appreciated!

Thank you!

 

1 answer

1 accepted

2 votes
Answer accepted
Thorsten Letschert _Decadis AG_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
February 21, 2024

Hi @Pierre Ibrahim ,

The first thing that came to my mind was obviously "shared workflows", but that doesn't seem to be a valid option for you here.

If you want to prevent the creation of those issues proactively, however, I'd guess your only option is to have the validator in place for every issue type/project of interest. (On that note, we'd have an app that - among other things - lets you copy workflow functions like validators from one workflow to another, which would at least reduce this effort, but honestly, not completely remove. Let me know if that's an option for you.)

Automation rules (default or JWT) would only support a reactive approach that would involve issues being created in a (by your definition) invalid state with the hint towards the creator to fix this, e.g., by automatically mentioning the reporter or transitioning the issue to a specific status, etc.

Overall, it depends on the actual numbers regarding projects, etc., but I'd gladly continue the conversation to figure out a solution that suits you well.

Cheers,
Thorsten

Pierre Ibrahim February 21, 2024

That's what I figured, thanks @Thorsten Letschert _Decadis AG_ , I appreciate your response!

Suggest an answer

Log in or Sign up to answer