Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,461,958
Community Members
 
Community Events
176
Community Groups

Is it possible to re-use a validator in Jira workflows?

Hi all,

I would like to do a specific check for existing linked issues and only allow the transition if the linked issue of a specific type is existing. 

I know, how I can do it for one workflow step and the code is already working. I am doing this with ScriptRunner validator and could share the code if needed.

Unfortunately, this check would have to be applied to every workflow step and would have therefore need to be copied again and again. The workflow consists of more than 20 steps and even more transitions.

Is there a way to re-use such a validator or configure a validator to be used in a specific set of transitions? Or is there a way to use the behaviors of ScriptRunner in order to make the linked issues required (but only for a given issue type)

Thanks!

 

2 answers

1 accepted

0 votes
Answer accepted
John Funk Community Leader Sep 14, 2021

Hi Stefan - Welcome to the Atlassian Community!

I don't use ScriptRunner so not sure if that is able to be copied or not. But have you thought about sharing the workflow across projects? How different are the workflows being used? Maybe even copy the updated workflow with the code in it and modify it to return the other functionality of the other workflows. 

In Scriptrunner, most scripts can be saved to the file system and called from there, as well as the standard "inline" option. 

If you have a validator script you want to reuse, you can save it once, and then tell all the transitions to read that script instead of having to copy and paste it every time.

But you still need to add that validator to each transition separately.

Same challenge - I want to apply the same validator script across multiple workflows and projects. Too many to do manually and I don't want to share as in one case the project admins can modify one issue type workflow for a project. 

I have build a script that given a project it

1. loops issue types (IssueTypeSchemeManager.getIssueTypesForProject)

2. retrieves the workflows (WorkflowManager.getWorkflow(thisPROJECT.id, it.id) and

3. loops actions, validators and args

     theWORKFLOW.getAllActions().each {  it.getValidators().each { it.getArgs().each { it.getKey()

My hunch is the name of the script is buried somewhere in args key FIELD_FUNCTION_ID or FIELD_CONDITION value using the hashCode but since Jira uses com.opensymphony.workflow I'm stuck there.

I am hoping once I can find one that has been manually set, I can decrypt and then re-encrypt and assign to other workflows. 

Any suggestions? Not finding much out there about  com.opensymphony.workflow.

John Funk Community Leader May 25, 2022

Hey @Tim Thompson  - You should always create a new question so more people will see it. Posted here is only seen by 3 people. 

will do... thanks.

Like John Funk likes this

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events