Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Validate that all linked issues are DONE - ScriptRunner Cloud

I created this question months ago, and we are now migrating to Cloud.

Is there a way someone can help me to translate the following code to Script Runner Cloud:

{code}

import com.atlassian.jira.component.ComponentAccessor
def linkMgr = ComponentAccessor.issueLinkManager
linkMgr.getLinkCollection(issue, currentUser).allIssues.findAll{it != issue}.every{it.resolution}

{code}

Thanks in advance!

Daniel

1 answer

1 accepted

2 votes
Answer accepted

So, I'm not exactly sure what your Groovy is doing (because I don't see it checking for "Done"), but ScriptRunner (and all validators) have to use Jira Expressions.

So to "Validate that all linked issues are DONE" this should work:

issue.links.filter(L => (L.linkedIssue.status.name == 'Done')).length ==
issue.links.length

I looked at the Jira Expressions examples for ScriptRunner here:
https://scriptrunner-docs.connect.adaptavist.com/jiracloud/validators.html

And also this old answer, although I think the final code is wrong:  https://community.atlassian.com/t5/Jira-questions/Jira-expression-to-validate-linked-issue-status/qaq-p/1300463

I tested my code using the excellent Jodocus Expression Tester.

Perfect!! Thanks for the suggestion of the Expression Tester, very useful.

Hi Darryl,

 

issue.links.filter(L => (L.linkedIssue.status.name == 'Done')).length ==
issue.links.length

 Thank you for your code, it did worked.

Also i have another follow up question , instead of all linked issues if i want to check only specific linked issue type

Types are

Is blocked by

is cloned by

 

i want to check only "is blocked by" are Done or not. Can you please help me with code.

I am new to script runner cloud

 

Appreciate your help

 

Thanks,

Anees

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you