Forums

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

How to add a select cascade field value in a custom email [script runner postfunction]

Fabio Manzoni
Contributor
December 29, 2020

Hi Guys, 

I'm following the documentation to send Send a custom email using a custom field https://scriptrunner.adaptavist.com/4.3.6/jira/builtin-scripts.html. It works, but with some problems.

The code

Custom field : <% out <<
issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("my select cascade field")) %> <

 

I'm using a select cascade field and the preview shows this.

Custom field : [null:JIRA SOFTWARE, 1:jira-users - Jira Users] 

Why apperas the nulll and number 1?

Can I remove this values?

 

1 answer

1 accepted

3 votes
Answer accepted
Alexander Pappert
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.
December 30, 2020

see https://community.atlassian.com/t5/Jira-questions/How-to-add-a-multi-select-dropdown-custom-field-value-to-custom/qaq-p/854441

Custom field value: <% out << issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("MySelect"))*.getValue().join(', ') %>

For a multiselect list getCustomFieldValue() returns a collection of Option object. With *.getValue() you convert this collection to a collection of the values of these Option objects. The value is the text the user sees. With join(', ') you convert this collection to one string, if there are multiple values these are separated by a comma.

Fabio Manzoni
Contributor
December 30, 2020

@Alexander Pappert ,

Your script worked, thank so much for your help.

Like • 2 people like this

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, likes for trees, atlassian community, social impact, tree planting campaign, community kudos, atlassian giving, environmental impact, sustainability, likes for good, atlassian social responsibility, community challenge

Make every click count—help us plant 50,000 trees! 🌳

Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!

Help us plant more trees
AUG Leaders

Atlassian Community Events