I am currently using the below expression to check if a linked issue has been set to done before the workflow allows the issue to move to the next step in the workflow.
// Check all linked issues of a certain link type are at certain status
issue.links
.filter(l => l.type.inward == 'To be done with')
.every(l => l.linkedIssue.status.name == 'Done')
I now need to clarify the check so that it only prevents the issue from transitioning if a specific issue type is linked with the 'To be done with' link type and that linked issue is set to done.
I will admit Jira expressions are not my strong suit and so would appreciate any assistance
Kind regards
Michael
Hi @Michael Wheatstone ,
Out of the box this is not possible. But I think you're using a Condition provided by some Marketplace App to achieve this.
If you mention which Marketplace App you are using, then community members who have experience with this app might be able to help.
For example, if you have Jira Misc Workflow Extensions, you can use the 'Linked issue status condition': https://appfire.com/resources/blog/jmwe-cloud-guide-configuring-workflow-conditions
Have a nice day, Rik
Hi Rik.
Yes apologies I am using a ScriptRunner Script to Add a ScriptRunner Script Condition that evaluates a Jira Expression to determine whether to allow the transition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Following Jira expression should allow transition if the linked issue (link: "To be done with" has issue type: "Task" and is in status category: "Done"
issue.links
.filter(link => link.type.name == "To be done with" && link.direction == 'inward')
.map(link => link.linkedIssue)
.filter(issue => issue.issueType.name == "Task")
.reduce((pass, issue) => pass && ['done'].includes(issue.status.category.key), true)
Of course, it would be better to use link.id and issueType.id instead of names. If you want to check status, instead of status category, replace issue.status.category.key with issue.status.name.
For those who don't have Script Runner, we have created Linked Issues Validator in wizard-like style, for which you don't need Jira expression knowledge. Leaving this here in case anyone need it: https://marketplace.atlassian.com/apps/1233642/workflow-building-blocks-for-jira?hosting=cloud&tab=overview
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Floating Electron.
While this seems close from my basic understanding of Jira expressions, when I use it, it is allowing the issue to transition regardless of what issue types are linked, and what the status of those issues are.
So it works for letting issues move forward, but it is not preventing issues that don't meet the criteria from transitioning.
My old expression would check link type and if the linked issue was done, I was hoping to expand this so it would check the link type, if the issue is a particular issue type, and if it was set to 'Done'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you require that the link must be of issue type: "Task" and status "Done", then:
issue.links
.filter(l => l.type.inward == 'To be done with')
.every(l => l.linkedIssue.status.name == 'Done' && l.linkedIssue.issueType.name == "Task" )
If you want to check only the status of links with the issue type: "Task", then:
issue.links
.filter(l => l.type.inward == 'To be done with')
.filter(l => l.linkedIssue.issueType.name == "Task")
.every(l => l.linkedIssue.status.name == 'Done' )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Floating Electron
The above works in testing when i run the script tests before applying to the workflow but is still not working in practice.
I think you're on the money though so I am going to look elsewhere to see if something else is allowing no compliant issues to get past even though the script should be preventing them.
Thanks for your assistance.
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.