The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

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 Champions.
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 # people like this