Hi,
I have following code but it returns null values.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.issue.fields.CustomField;
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
CustomField customField = customFieldManager.getCustomFieldObject('customfield_19115');
def str = issue.getCustomFieldValue(customField);
return str.toString()
I ave feeling select list vs string field is issue, but not sure how to resolved.
Please let me know the solution.
Thanks
Hey Mangesh,
in which context do you run your script? As a scripted field? Is the refernece to the custom field valid? Does the given issue have set a field value? What is the type of the field with the id 19115
Cheers,
Julian
Hi
Yes, I am running the code as a scripted field.
Yes, the reference to the custom field is valid as well.
Also, 19115 is select list type field.
Thanks
Mangesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
assuming you have a single select field and the given issue has a value your script should work. I've just tested it on a staging environment.
Just to be sure - when I work with the preview function adding a scripted field, I sometimes make the mistake to enter an issue key with lowercase letters. The result is that I get null values. So my question is, where you get the null values? In the preview or when opening an issue? If you get those in the preview - Did you entered the issue key correctly?
Cheers,
Julian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The issue was, on a scripted field screen there is a field called: Template, I changed to Text field, instead of a number field.
Thanks for your response though
Mangesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.