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: 

Can I get email address of user custom field in behaviours

мария аношина
December 30, 2019

Can I get email address of user custom field in behaviours?

I have a customfield -type- user.

Is there a function that, using behavior, pull out the email of the entered field on the portal

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Ilya Turov
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, 2019

you get the string value of the field in the behaviours, so you need to use userManager to get ApplicationUser object and retrieve email from it :

import com.atlassian.jira.component.ComponentAccessor
def field = getFieldById(getFieldChanged())
def userName = field.value
def email = ComponentAccessor.userManager.getUserByKey(userName)?.emailAddress