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
Gaston Valente
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 27, 2017

You can filter links by type, but i think that it's not possible to add the quantity to the condition with the standard functions:

 

https://scriptrunner.adaptavist.com/latest/jira/jql-functions.html#_haslinktype

James Brown
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 27, 2017

Thank you for responding. However, I was looking for more information as I stated in the first part that I am able to easily search for linked issues using ScriptRunner.

TAGS
AUG Leaders

Atlassian Community Events