Facing a issue with filtering tickets

Hi Team,

One of the client account enable fields for filtering tickets when ticket fields have values result coming as zero

This is a screenshot of the ticket:

My ways:

  1. https://sanlamindie.freshdesk.com/api/v2/search/tickets?query=“cf_id_number%3A’7894’”
  2. https://sanlamindie.freshdesk.com/api/v2/search/tickets?query=“cf_policy_number%3A’12345’”
  3. https://sanlamindie.freshdesk.com/api/v2/search/tickets?query=“cf_policy_number%3A’12345’”
  4. https://sanlamindie.freshdesk.com/api/v2/search/tickets?query=“cf_id_number%3A’7894’”
  5. https://sanlamindie.freshdesk.com/api/v2/search/tickets?query=“cf_policy_number:12345”
  6. https://sanlamindie.freshdesk.com/api/v2/search/tickets?query=“cf_id_number:7894”

here encode single quotation not displaying properly I worked on that one also instead of single quotation used %27

Let me know anything I missed here?

Thanks,
Tejasri

2 Likes

Hello Tejasri,

Your last two requests:

they look absolutely fine and they should give you the desired result.

However, on reading the documentation, I noticed this, quoting it here:

If you’re not getting a result for the above query, there’s a chance that the field might have been created recently or it has been moved to a new infrastructure. To query on these custom fields, use ‘custom_string’ instead of the actual field label.

Let me know if this works for you.

4 Likes

@yusrakhatri, If another ticket for another custom field(other than I am looking) also has the same value then we won’t get actual results right?

Can you please try /api/v2/search/tickets?query="(cf_id_number:7894)" in postman or /api/v2/search/tickets?query=%22(cf_id_number:7894)%22 in cURL.

1 Like

Hey @ManiDeepak_Vandrangi,
Tried about 2 queries still results are showing zero :frowning:

I have a ( and ) around " " in query as shown in example. Even if you are facing the error, please DM me as we need to get that customer account details.

1 Like

We checked the account and found the custom fields are not of type numbers but of type “Single Line Text”

Interesting. I was testing the API for edge cases, just in case. So if these custom fields are “Single Line Text”, wrapping the value with single quotes should work in this case, right? Like:

/api/v2/search/tickets?query="cf_id_number:'7894'"

@ManiDeepak_Vandrangi, I tried with single quotes even results are showing zero

@Tejasri_Kalluri
Can you try with query=“custom_string:‘7894’” as @yusrakhatri suggested ? Replace 7894 with whatever values you want to search for.

1 Like

Yes @ManiDeepak_Vandrangi, I tried the results are coming. but also I found a drawback in this query. If another ticket, another custom field(other than id number and policy number fields) also has the same value(7894) then we won’t get actual id number or policy number filter tickets right?

1 Like

Yeah @Tejasri_Kalluri. We are checking with :freshdesk: team to see if there are any alternatives

okay thank you @ManiDeepak_Vandrangi

Did you find any solution to this issue?