Set assignee to value found in Elements connect field

Dimitra Melanitis July 6, 2020

Hello,

I have an Elements Connect custom field containing a user name. On transition, I need to set the assignee to the value found in this field. I'm trying to use a post function and tried many solutions found here but none worked unfortunatelly.

I found this

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.util.UserManager

def pluginAccessor = ComponentAccessor.getPluginAccessor();
def plugin = pluginAccessor.getPlugin("com.valiantys.jira.plugins.SQLFeed");
def serviceClass = plugin.getClassLoader().loadClass("com.valiantys.nfeed.api.IFieldDisplayService");

def fieldDisplayService = ComponentAccessor.getOSGiComponentInstanceOfType(serviceClass);

def customFieldId = "customfield_10613";

String displayValue = "";
Object displayResult = fieldDisplayService.getDisplayResult(issue.get("issuekey"), customFieldId);
if (displayResult != null) {
displayValue = displayResult.getDisplay();
}

issue.setAssignee(ComponentAccessor.userManager.getUserByName(displayValue))
issue.store()

//return displayValue;

But the displayValue prints what it should

 

Your script ran successfully against issue ISSUE-258

Result type:
String
Result value:
Donald Duck

 

But when I remove the return display and try to set this value as assignee I get

Your script ran successfully against issue ISSUE-258

Result value:
null

 

Could you please tell me what I'm doing wrong? I'm quite new to Jira :-/

2 answers

1 vote
Simon Laffont
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.
July 6, 2020

Hello Dimitra Metanitis,

I'm part of the Elements Support team.

Is your connect field a Live Text field or a Live User field?

Can you tell me what post-function you are currently using?

In addition, can you please tell me which version of Elements Connect you are using?

Kind regards,
Simon.

Dimitra Melanitis July 6, 2020

Hello Simon,

 

It is a Live Text field. The post function is

Update parameters of the Elements Connect: Copy display to issue field Function for this transition

Version is 6.3

Thanks for your help!

 

Dimitra

0 votes
Simon Laffont
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.
July 6, 2020

Thank you for this information.

to go further, I would need to know your Connect field configuration. 

I invite you to create a ticket on our Support platform by clicking on the following link: Support Elements 

We will then continue to deal with your problem where we left off.

Kind regards,
Simon.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events