Copy user property to custom field.

How to copy assignee property to custom field of an issue in workflow transition?

1 answer

This widget could not be displayed.
Rina Nir Solutions Partner Jul 23, 2014

You can do this with scripting (Script Runner free plugin, Groovy), or with Kepler's SIL ( which is another scripting langiage (probably simpler then Groovy). Is this an option for you?

I do not know a plug-in that provides it "out of the box".

Thanx. Maybe you know code how to do it in Script Runner? Or point me to the documentation where I could dig that info?

Rina Nir Solutions Partner Jul 23, 2014

I do not have a code that does exactly this (ie get UserProperty and set it in a CustomField),

But, one of the trickiest things to note is the very specific scheme to follow to make sure that your update to the custom field is actually written into the DB and persisted. To acieve this you should follow a similair scheme to this:

MutableIssue myIssue = issue

		//Update hoursSummaryString
		CustomField hoursSummaryString=customFieldManager.getCustomFieldObjectByName(hoursSummaryStringFieldName)
		myIssue.setCustomFieldValue(hoursSummaryString, billingStr)
		Map<String, ModifiedValue> modifiedFields1 = myIssue.getModifiedFields()
	    FieldLayoutItem fieldLayoutItem1 =ComponentManager.getInstance().getFieldLayoutManager().getFieldLayout(myIssue).getFieldLayoutItem(hoursSummaryString)
		DefaultIssueChangeHolder issueChangeHolder1 = new DefaultIssueChangeHolder()
	    final ModifiedValue modifiedValue1 = (ModifiedValue) modifiedFields1.get(hoursSummaryString.getId())
	    hoursSummaryString.updateValue(fieldLayoutItem1, myIssue, modifiedValue1, issueChangeHolder1)

For the user property itself, you can have a look here:

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Aug 06, 2018 in Jira Service Desk

A is for Activate: Share your top Jira Service Desk onboarding tips for new users!

Hi, everyone! Molly here from the Jira Service Desk Product Marketing Team :).  In the spirit of this month's  august-challenge, we're sourcing stories of Jira Service Desk activation fro...

575 views 25 15
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you