Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

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
Community showcase
Published in Jira

Announcing the waitlist for Jira Work Management

Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...

638 views 10 16
Read article

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