I have a customfield object and I want to get the value of an attribute of that field.
For instance I have the custom field "customfield_10010" with attribute "requestType". With the field parameter I get the total custom field object, but I want only the "customfield_10010": { "requestType" } value.
Is that possible.
Hi @Jan Hidding, Yes, the value of an attribute may be extracted from a Jira custom field object, as long as the field's data structure contains the requested property. This frequently entails obtaining the field's value and then traversing through its data structure to extract the desired property.
Example Approach in Groovy
If you're using ScriptRunner and want to extract the requestType property from a custom field (such as "customfield_10010"), here's how:
1. Retrieve the custom field value.
Use Jira's API to get the value of a custom field for a particular issue.
2. Access the desired attribute.
If the field's value is a JSON object or has a hierarchical structure, parse it to retrieve the desired property.
Hi @Jan Hidding ,
Reading your question I suspect you mean you want to fetch the value of a custom field for a specific Issue?
If so, you need to get the Issue object instead of the Custom Field object.
The Custom Field object is the abstract, generic Field which can be added to a Screen and only has attributes such as Type (text, single select, user, number etc). But the Field object will never have an actual value.
Hope that helps.
Have a nice day!
Rik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.