Maybe you can try this?
issue.getComponentObjects().getAt(
0
)?.getName()
Best Regards,
Mirek
Hi Mirek,
I tried this snippet too. Syntax check was successful, but output was blank.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Mirek , I tried your solution, it is working but it is only showing output for the very first component value, not all the values present in component.
Suppose I have components = a,b,c
so when I execute issue.getComponentObjects().getAt(
0
)?.getName()
the output is a
Is there any way so that we can pull all the component values?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try simply
issue.components.name
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gezium, thanks for the snippet, but this didn't help me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Where are you running it.
I just tried in script console (JIRA 7.3) and worked.
Maybe you are running it on a post function?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am trying in JIRA 7.2.2 Scriptrunner, i want to fetch value which is present in Component/s and display in scripted field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, I added it in a scripted field, it originally shows a typing validation error, but bypassing and saving works.
Even just by preview it shows the component/s, Also in screen it's shown as a list []
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you please share the whole code in here??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
it's just that line.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Gezim Shehu [Communardo] this works for me.
I am trying this in script console , it is giving a red mark but in output it is giving me all component values
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thx mate - it is as simple :-)
// Console
def componentField = Issues.getByKey('KEY-123').components.name
// Shows a list of all Components
// I can now check if my component is part with
componentField.contains("My Value")
// Output "true" when Component is part of the ticket
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.