Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can I search for issues using values within JSON custom fields?

dmatijasevic July 30, 2020

I am trying to search for issues using values within a custom field that is a JSON object. Here is an example:

"customfield_15000": {
    "data": {
    "text": "blabla",
},
"identifiers": {
"id": "18",
"name": "Main location",
"value": "Left of centre"
}
}

I want to search using REST API (/rest/api/3/search) for all issues that have value of customfield_15000.identifiers.id = 18 (in JSON-speak). I tried using cf[15000].identifiers.id = 18 but I'm getting an "Error in the JQL Query: Expecting operator but got '.identifiers.id'. etc" message.

Is this even possible using JQL/REST?

Thanks in advance for any suggestions!

1 answer

0 votes
Michael Raj July 30, 2020

Hi @dmatijasevic ,

I'm not an expert but JSON is a result of the search, not the search parameters.

Check if JQL recognizes this particular customfield_15000 and/or value/name/id. If it does, you can use it in the request sent to API.

If not, search for all issues (most accurate you can be, maybe use other filters) and in the code check if issue has the value you're looking for. I know it may be time consuming but I believe it would work.

 

Best,

Michael

dmatijasevic July 31, 2020

Yes, you are right, this JSON is a result of the search. My question is probably not phrased correctly, I am looking for the JQL statement that would search for the value within a complex custom field. I'm afraid, I can't phrase it any better.

Sunny Ape
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.
August 1, 2020

What do you mean by 'custom complex' field? What specific type of field is customField_15000? Is it a text field, drop-down list, radio buttons, user lookup etc?

dmatijasevic August 3, 2020

Actually, it seems to be a field that JIRA Service Desk uses internally to hold relationship between "classic" requests and SD requests, so the answer is I have no clue. Sadly, the "search" function in JIRA SD is awful so I am trying to find a way to use Core APIs to compensate.

In the meantime, I found another way to search for issues, so this question is no longer relevant in that regard.

Thanks to all who replied!

Michael Raj August 3, 2020

Hi @dmatijasevic ,

could you share your new way of searching for issues? Maybe I can learn something too :)

 

Best,

Michael

dmatijasevic August 4, 2020

It's not really a new way, I just found how requests are mapped between Jira and Jira SD (service desk becomes project) so using "classic" JQL proved enough.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events