hi all,
I want to extract the value of components in the my scriptrunner postfunction as following
def s5 = ((String)(issue.components.name))
but it gives me following error. how can i handle this issue. any advise will be so appreciated
[Static type ckecking] - No such property: name for class: java.util.Collection
issue.components // this is object of java.util.Collection
`issue.components` return Collection of components, and `Collection` class doesn't have `name` property.
You have iterate over this collection and get `name` for each value. In return you will get list of names. Something like this.
def names = [];
issue.components.each { component -> names.add(component.name) }
many thanks for your reply. it gives me following information;
[ProjectComponentImpl { name='Service1', description='', lead='s1', assigneeType='1', projectId='10811', id='11334' }, ProjectComponentImpl { name='Service2', description='', lead='s2', assigneeType='1', projectId='10811', id='11323' }]
but i want just to return component name as following
[Service1,Service2]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is giving you a list of ProjectComponentImpl. You need to get value of name from each component now. So you need to iterate over this list.
In above code that I have posted, `def names` will contains your desired list of names of component.
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.