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?
After reviewing your description, I have a doubt to clarify i.e. what type of custom field are you using for the Invest / Area Theme field?
From the look of the log output you have displayed, I suspect it is a DB Picker you are using. If this is so, then the output returned is correct. The DB Picker will return the id value that has been set in the DB Picker's SQL Configuration.
If you want to get the value instead of the ID, you can refer to this working example from the Adaptavist Library.
I am looking forward to your feedback and clarification.
Thank you and Kind regards,
Ram
The type of the field is a database values selection field. Should the code here example from the Adaptavist Library work?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
From the screenshot you have shared, this doesn't appear to be the DB Picker field from ScriptRunner.
Instead, it looks like it's from another third-party plugin.
To proceed, could you please share a screenshot of the field's configuration, i.e. something like:-
I am requesting this so I can get a better understanding of the field you are using.
If the field is from another third-party plugin, please specify the Vendor the the plugin name.
I am looking forward to your feedback.
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Ram Kumar Aravindakshan _Adaptavist_
Here is a screenshot of the custom field configuration "Invest. Area/Theme"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I can confirm that the field you are using is not from ScriptRunner. Instead, it is from another third-party plugin called Database Values for Jira.
Jira no longer supports this plugin as it is only compatible with Server instances and not even DC.
I suggest you change the approach you are currently using, i.e. do not use the Database Value for Java's Database Values Searcher field.
Instead, use ScriptRunner's Database Picker or convert a Single Line Text Field into a Single Select or Multi Select field, depending on your requirement.
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you tried the suggestion I provided and changed the field to Database Picker to convert the Single Line Text Field to a Single or Multi Select List?
If yes, does it solve your issue?
I am looking forward to your feedback.
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online 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.