Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,368,764
Community Members
 
Community Events
168
Community Groups

How to find specific related issue using Groovy scripting in Post Function

Hi there, 

I need to set a specific value on a custom field within some linked issues but not all of them. 

I'm using the 'Set field value of related issues (JMWE app)' Post Function and am using the 'Issues Returned by the following Groovy script' option to find the specific related issues that I require updated. 

From the research I've carried out to date the following syntax returns a list of all of the related issues 

issue.getLinkedIssues()

And these are the results:

Result type:
ArrayList
Result value:
[Test-250, Test-249]

So this gives me all the related links which is great but I need to break that down further and only have the 'Result Value = Test-249' and not just list all of the related issues. 

Is this doable? Does anyone have the correct syntax to use in this scenario? 

Any help appreciated... 

Thanks

 

1 answer

0 votes

What is your criteria for filtering the linked issues? How do you decide which linked issues should be updated?

Hi David, 

The linked Issues are all using the same Link Type so I'm thinking that the best way of filtering the issues so that I just update the one I need to is via the 'Issue Type' name...

Is that feasible? 

 

Rgds,
Vivienne

Hi Vivienne,

sure, you could do something like:

issue.getLinkedIssues()?.findAll{it.get("issuetype")?.name in ["Bug","Task"]}

to return all linked issues of type Bug or Task.

Hi David, 

That worked... 

Thank you so much for the help on this... appreciate it. 

Rgds,
Vivienne

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS

Atlassian Community Events