Forums

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

Groovy: validate correct link type

Jan Sękara February 13, 2017

Hi,

I need to validate on create transition, that issue has a specific link (name: CR).

I have scriptrunner if it helps.

 

No expirience in groovy tho...

3 answers

1 vote
Thanos Batagiannis [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.
February 14, 2017

Hi Jan,

There is an almost exact example (you only have to change the linkDescription) in the documentation

And this validator will be on the Create step.

David Willox
Contributor
February 16, 2017

Hi Thanos,

Maybe I'm not using this correctly but In my experience the example script does not work when creating an item. Because the item has not yet been created and the link has not been created the validator simply throws an exception every time I click "Create".

Placing the validator at the next transition always works however.

Like • Lara Lopez likes this
0 votes
Jan Sękara March 15, 2017

How to add a condition to this code.. so it would work only for projectkey= CR ?

0 votes
Jan Sękara February 14, 2017

It's killing my CPU... this script.cpu_jira.PNG

Thanos Batagiannis [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.
February 14, 2017

Highly unlikely for that script to cause a CPU spike.

Try something more simple, like just throwing an exception every time

import com.atlassian.jira.issue.IssueFieldConstants
import com.opensymphony.workflow.InvalidInputException

throw new InvalidInputException("You must link a blocker issue at this transition")

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, confluence, loom, atlassian intelligence, ai notes, ai-powered meeting notes, atlassian community events, ace, confluence ai, loom ai integration, ai note-taking, atlassian ai features, team '25, atlassian live learning, confluence automation

Unlock AI-powered meeting notes: Join our live learning session! 📹

Did you catch the news at Team ‘25? With Loom, Confluence, Atlassian Intelligence, & even Jira 👀, you won’t have to worry about taking meeting notes again… unless you want to. Join us to explore the beta & discover a new way to boost meeting productivity.

Register today!
AUG Leaders

Atlassian Community Events