I've used the following code to try to validate that there is a certain link type when a custom field has a certain value. It is failing whether I create the link before the transition or when I try to link during the transition. I've used the link name, in inward link name, and the outward link name. Nothing successful. Any suggestions?
if (cfValues['Implementing Standard Fields']?.value == "Yes") { return issueLinkManager.getOutwardLinks(issue.getId())*.issueLinkType.name.contains('Implementation') } else { return true }
Remove the cf validation for the time being and check the linking works. What you have looks correct but for clarity use:
def issueLinkManager = ComponentAccessor.getIssueLinkManager() issueLinkManager.getOutwardLinks(issue.getId()).any { it.issueLinkType.name == 'Implementation' }
If that doesn't work can you post a screenshot of your Issue Linking config page.
That won't work for issues added this transition, for that see https://scriptrunner.adaptavist.com/latest/jira/recipes/workflow/validators/simple-scripted-validators.html#_checking_linked_issues.
I have two ideas offhand. The first is, is "Implementation" part of the actual link "Name", or is it just part of the outward/inward link description?
The second thought is, does the custom field portion of the validator work if you return false? As in:
if (cfValues['Implementing Standard Fields']?.value == "Yes") { return false } else { return true }
That's how I normally narrow down the area of failure. What type of custom field is that? If it's not a string field, you may need to compare to a boolean, for example.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am not sure for groovy sintax, but for Java it should be:
cfValues[
'Implementing Standard Fields'
]?.value.equals(
"Yes")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't think the if statement is my problem. When I choose, "No" it let's me pass through. It's when I choose yes, that it's not recognizing the issue link.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, second idea: there outward and inward links. Are you sure that you try to get correct one.
Third: issueLinkManager.getOutwardLinks return issue list. I am not sure of groovy sintax, but there should be some loop.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've tried pretty much every combination of outward and inward
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Join us June 26, 11am PT for a webinar with Atlassian Champion Robert Hean & Loom’s Brittany Soinski. Hear tips, stories, and get your burning questions answered. Learn how Loom makes training and enablement easier. Don’t miss it!
Register todayOnline 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.