Reading from user picker custom field

AbrahamA
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.
October 18, 2012

Hi

In my plugin I am reading from a user picker custom field.

I see that the issue that I am reading from has the value when I look at the issue in JIRA. However when I try to read the same value from my plugin I get null.

Is reading from user picker any different from reading from other custom fields. Please let me know.

Thanks

Abe

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Jobin Kuruvilla [Adaptavist]
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.
October 19, 2012

What happens when you try issue.getCustomFieldValue(certificationPM)? Also are you sure the issue object has the correct Issue?

AbrahamA
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.
October 19, 2012

It has correct issue

Here is the output:

2012-10-19 21:44:47,347 http-8080-6 INFO admin 1304x3133x1 ex4ha3 127.0.0.1 /secure/QuickEditIssue.jspa [my.jira] value from field in issue to asign user:com.atlassian.crowd.embedded.ofbiz.OfBizUser@57352299

If I cast the retrun value to string it has null.

This has me beat..

Jobin Kuruvilla [Adaptavist]
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.
October 19, 2012

Don't cast it to String because it is a user field. Cast it to User and then get the details from User object.

0 votes
AbrahamA
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.
October 19, 2012

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
CustomField certificationPM = customFieldManager.getCustomFieldObjectByName("Certification PM");
String strCertificationEngPM = "NoValue";
if(certificationPM != null){
log.info("value from field in issue to asign user:"+certificationPM.getValueFromIssue(issue));
strCertificationEngPM = certificationPM.getValueFromIssue(issue);
}

It is getting into if condition indicating that field is found, log statement output is:


value from field in issue to asign user:null
But when I see in the issue the field has value.

					
				
			
			
			
				
			
			
			
			
			
			
		
TAGS
AUG Leaders

Atlassian Community Events