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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Set assignee to value found in Elements connect field

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

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.

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

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
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

681 views 7 23
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you