Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,459,871
Community Members
 
Community Events
176
Community Groups

How can add user's email into a custom field?

Edited

I want to add a Jira user's email to a custom field base on the selection of the user's display name from a custom drop-down field. There is a custom drop-down field "Contact Person" which has about 8 to 10 users. The name is the same as the Jira display name, but we added a custom field that users only can select those users.

The use case is that once the user selects a user (John Doe) from the dropdown field, it should add that user's email into a custom email field. I'll hide the email field from creating screen and it'll be only in the view screen. How can I achieve that?

 

def conPerson= getFieldById('customfield_10519')
def emailAddr= getFieldById('customfield_10520')
if(conPerson.value == 'John Doe') {
set emailAddr value to user's email
}

Thank you for your help

1 answer

0 votes
Alex Rising Star May 16, 2022

Hi @Shah Baloch 

How do you plan to implement that using a post-function or a listener to trigger at the create issue event?

Cheers 

Alex 

I would like to have it in the initial stage like when the issue is created it should have the email address in the email field. 

I was able to make it works with a behaviour script by mapping manually users' names with their emails. The problem is someone needs to maintain the script when there will addition and deletion of a user. I mean have to maintain the script when need to remove or add a member. I was looking if there will be an easy way to not maintain the script all the time?

def optionsConMap = [
   'User Name': 'user@email.com',
     'Some User': 'some@email.com'
]

def option = getFieldById('customfield_10519').value
def emailAddr = optionsConMap[option]
getFieldById('customfield_10520').setFormValue(emailAddr)

def email = getFieldById('customfield_10520')
email.setHidden(true)

 

Thank you for your help

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events