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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.