Forums

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

How to search issues based in a customfield name value that must contain some text? Via API REST

Ian Carlos
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.
January 19, 2023

Hi everyone! Hope you're fine

I'm trying to perform some report automations based on my Jira Issues and I would like to perform an Issue search via API REST whithin a time frame (I've already achieved this) and ONLY if a certain customfield name value contains a text 

 

I know that this works:

"https://xxxxx.atlassian.net/rest/api/2/search?jql=created >= START_DATE_VAR AND created <= END_DATE_VAR AND "... 

So I would like to add after the last AND something like

"CustomFieldXX".name ~ "TEXT"

Hopefully you could give me a hand

 

Thank you so much for your time!

Best regards,

2 answers

1 accepted

0 votes
Answer accepted
Ian Carlos
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.
March 16, 2023

I found the answer!

If anyone interested, is this:

Since my customfield was an Asset Object, I did it using AQL mixed with JQL

This:

"CustomFieldXX" in aqlFunction('name LIKE TEXT')

Hope this could be useful for you

0 votes
Vamsi Kandala
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.
January 19, 2023

Hi @Ian Carlos

Instead of 

"CustomFieldXX".name

Can you try with

customfield_xxxxx ~ "TEXT" 

Where xxxxx is the custom field id of the associated custom field

Basically, your API call would be like

"https://xxxxx.atlassian.net/rest/api/2/search?jql=created >= START_DATE_VAR AND created <= END_DATE_VAR AND customfield_xxxxx ~ 'TEXT'"

Hope this helps.

Thanks,
Vamsi

Ian Carlos
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.
January 19, 2023

Hi Vamsi

 

Thanks a lot for your fast reply

 

I tried what you say and it gives me the following error:

The operator '~' is not supported by the 'CUSTOMFIELDXX' field

Do you have any idea of what to do? 

 

Thank you so much for your time

Vamsi Kandala
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.
January 19, 2023

Hi @Ian Carlos

What is the type of the custom field 'customfield_xxxxx'?

The "~" operator is used to search for issues where the value of the specified field matches the specified value (either an exact match or a "fuzzy" match — see examples below). For use with text fields only, i.e.:

  • Summary
  • Description
  • Environment
  • Comments
  • custom fields that use the "Free Text Searcher"; this includes custom fields of the following built-in Custom Field Types
    • Free Text Field (unlimited text)
    • Text Field (< 255 characters)
    • Read-only Text Field

Please refer to this article for more help:

https://support.atlassian.com/jira-software-cloud/docs/advanced-search-reference-jql-operators/

Hope this helps.

Thanks,
Vamsi

Ian Carlos
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.
January 19, 2023

Hi Vamsi, again, thanks for your fast reply and sorry for my late one (I was taking lunch)

 

mmm, the customfield is related to an Asset, that's why I thought there it could be a "object.name" or something like that

I don't know how to do it with AQL and how to mix this with JQL

Sorry

 

And thanks a lot for the documentation! I will give it a look

Suggest an answer

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

Atlassian Community Events