Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Find an object with an attribute value within a collection of objects in groovy

Mouna Hammoudi
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 26, 2023
0

I have a collection of type ProjectComponent, I am using the following code to find an object in my collection with a specific name. Here is the code:

 if(newIssueproject.getComponents().stream().anyMatch { it.getName().equals(shortenedComponentName)  }){
                        newComponent=it
   }

I am receiving the error Script function failed on Automation for Jira rule: UpdateExecutionSummary , file: SuperFeature/rest_superFeatureGenerator.groovy, error: groovy.lang.MissingPropertyException: No such property: it for class: SuperFeature.rest_superFeatureGenerator

But I have looked up tutorials and the it should work automatically even if it is not declared as you can see here:

enter image description here

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, jira product discovery, jpd premium, product management, idea management, product discovery, jira premium, product planning, atlassian community, product development, roadmap planning, product prioritization, feature management

Introducing Jira Product Discovery Premium ✨

Jira Product Discovery Premium is now available! Get more visibility, control, and support to build products at scale.

Learn more
AUG Leaders

Atlassian Community Events