How to Fetch Component/s values using scriptrunner

Jeevan Kumar M J March 6, 2018

I am trying to fetch a value from Component/s field using scriptrunner, but unable to find any value.

2 answers

2 votes
Mirek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 6, 2018

Maybe you can try this?

issue.getComponentObjects().getAt(0)?.getName()

Best Regards,

Mirek

 

Jeevan Kumar M J March 6, 2018

Hi Mirek,

I tried this snippet too. Syntax check was successful, but  output was blank. 

Sugandha April 29, 2019

@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?

0 votes
Gezim Shehu [Communardo]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 6, 2018

Try simply

 

issue.components.name

Jeevan Kumar M J March 6, 2018

Hi Gezium, thanks for the snippet, but this didn't help me.

Gezim Shehu [Communardo]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 6, 2018

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?

Jeevan Kumar M J March 6, 2018

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.

Gezim Shehu [Communardo]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 6, 2018

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 []

Jeevan Kumar M J March 6, 2018

Can you please share the whole code in here??

Like Fabian Krehnke likes this
Gezim Shehu [Communardo]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 6, 2018

it's just that line.

Like Junior Lobo likes this
Sugandha April 29, 2019

@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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events