Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Behaviour- set current user in a User-field but display only his full name

Dan27
Contributor
July 21, 2020

Hello,

 

I am using behaviour to set the current user in a field (User picker type) when issue moves to Done (on Done screen).

 

I want to display only the full name of the current user, But wen I did it in my script, Jira cam't find this user.

This is my script:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.fields.CustomField
import java.sql.Timestamp

def customFieldManager = ComponentAccessor.getCustomFieldManager()

// Getting custom field object
def CustomFieldName = getFieldById("customfield_XXXXX")

//Get current user
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
def fullName = currentUser.displayName

CustomFieldName .setFormValue(fullName.toString())

 

How can I do this display without distroying the functionallity?

Attached print screen of the behaviour:

ps.JPG

Thank you!

Daniel

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Omprakash Thamsetty
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.
November 14, 2022

I know this is very old post. 

 

You can use in line 13. 

 

def fullName = currentUser.getDisplayName()
TAGS
AUG Leaders

Atlassian Community Events