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

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 Leaders.
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

Suggest an answer

Log in or Sign up to answer