I am trying to retrieve the value of a custom field, the custom field looks like this in my Jira issue:
I have been able to find the ID by rightclicking on the custom field and choosing the option Inspect Element, Here is the ID:
I wrote the following code to extract the value of the custom field:
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_10790");// here replace the ID with ID of your custom field.
def value = (String)issue.getCustomFieldValue(customField);
log.warn("MOUNA CAMELIA VALUE "+value )
The problem is that I am getting the following value in my log:
MOUNA CAMELIA VALUE 1000547
This is a wrong value since it should normally return the value shown below. How to fix this problem?
The type of the field is a database values selection field so this will not work
Here is the solution:
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_10790");// here replace the ID with ID of your custom field.
def value = issue.getCustomFieldValue(customField) ;
newissue.setCustomFieldValue(customField, value)