It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Just updated ScriptRunner to 4.3.15 now Custom Fields not Available?

KEITH TYSON Dec 18, 2016

I have just updated ScriptRunner.

In Send Custom Email, I was using a custom field (script field) in the "To Issue Fields" field.

However, after updating, it cleared the value of this field so my emails have no to addresses. When I go now to enter the custom field again it gives a dropdown of available custom fields, but the script fields are not listed?

3 answers

1 accepted

0 votes
Answer accepted
Thanos Batagiannis [Adaptavist] Community Leader Dec 19, 2016

Hi Keith,

In your Condition and Configuration section add

import com.atlassian.jira.component.ComponentAccessor

def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Scripted Field")

if (!cf)
    log.debug "Scripted field does not exist"

def recipients = issue.getCustomFieldValue(cf) as String


In order to preview you have to select the Disable validation checkbox because you are setting from/to/cc etc dynamically.

PS. Where variable mail is type of Email

Let me know if this does the trick

regards, Thanos


KEITH TYSON Dec 19, 2016

Hi Thanos,

This has done the trick perfectly.

Thank you very much for your help on this.

Thanos Batagiannis [Adaptavist] Community Leader Dec 19, 2016

Cool, anytime Keith. 

I will investigate how "easy" will be to add the scripted fields in the dropdown with the available To Issue fields. But the main reason behind not to include is that with a scripted field we are not sure what kind of value/s will have.

Therefore we also updated the Configuration section in order to increase it's flexibility and make it easier to do more complicating things via scripting.

 Hope that in overall you find the changes better.

regards, Thanos   

0 votes
Thanos Batagiannis [Adaptavist] Community Leader Dec 19, 2016

Hi Keith,

The fields that are available to select from are those that are quite possible to hold valid email addresses or users (and therefore possible to get their email), aka the fields that their type is instance of UserCFType, MultiUserCFType, MultiGroupCFType or TextFields.The scripted field is not in the available fields.

But you can add recipients from the Condition and Configuration section using

mail.setTo(String emailAddress)

If you want to tell me what type of template you use for your scripted field I can assist further.

regards, Thanos

0 votes
KEITH TYSON Dec 19, 2016

Hi Thanos,

Thank you. I am using Send Custom Email in the workflow Post Functions. I am doing all the formatting (template) in the Email Template section.
I tried to set the email address in the 'Condition and Configuration' section using something like the example you gave ( mail.setTo("") ) but it still gives "You must provide either fields or addresses to send emails to."

I have a custom field (script field - below) that stores a comma separated list of email recipients - which was working 100% with previous versions. If I can somehow still use the email addresses in this field and use mail.setTo, that would be good?

image2016-12-20 8:37:40.png

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Jira

Try Jira Cloud for Outlook: Organize your work without leaving your inbox

Hi Atlassian community, My name is Max and I work on the product integration team at Atlassian. I am pleased to announce the early access program for the Jira Cloud add-in for Outlook. This add-in...

2,397 views 6 15
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you