I’m trying to perform a search on multiple phone numbers for Contacts using the V8 API in SuiteCRM 8.8.0. I need to match any variant of a phone (mobile, work, home, etc.).
Here’s an example of the GET request I’m sending:
I have a contact with phone_mobile = "011387061152333" and phone_work = "011387061152333", but the API returns an empty result set.
My SuiteCRM version is 8.8.0.
I’ve seen that this problem was reportedly fixed in previous versions of SuiteCRM (JSON - Filter with OR - #4 by John), but in my installation it still doesn’t work.
Question:
Is multi-value $like on the same field supposed to work in SuiteCRM 8.8.0? If yes, how should the request be structured to match multiple variants on the same field?
SELECT COUNT(*) AS cnt FROM contacts LEFT JOIN contacts_cstm on (contacts.id = contacts_cstm.id_c) WHERE (contacts.phone_mobile = '016013311331' OR contacts.phone_work = '98765432456') AND contacts.deleted = '0'
SELECT COUNT(*) AS cnt FROM contacts LEFT JOIN contacts_cstm on (contacts.id = contacts_cstm.id_c) WHERE (contacts.phone_mobile = '016013311331' OR contacts.phone_work = '12345678032') AND contacts.deleted = '0'
There are multiple queries now to respond to the JSON request.
But all queries look like, as if only the last parameter for one field survives.
That might be just the way the API is implemented. Maybe it works with GraphQL.
Do you want to file a feature request on Github?
I’m curious: What phone system are you integrating?
And what’s the scenario where you have to search for different numbers in the same field for one contact?
thanks for testing this and confirming the behavior.
I’m integrating SuiteCRM, and my use case is that I need to search contacts by phone number. When a user enters a phone number, I generate several normalized variants of that number (with/without country code, with +, with 00, with/without spaces, etc.).
The idea is to look for those variants across all phone-related fields (phone_mobile, phone_work, phone_home, etc.) in one request. That’s why I need multiple values for the same field — e.g. if a contact has 061123456 stored as work phone and another contact has +38761123456 stored as mobile, both should match.
It looks like the current API only supports OR between different fields, but not multiple values on the same field (where only the last one survives). That limitation means I can’t fully apply the variant search on SuiteCRM via the current filter syntax.
Does anyone have an alternative solution or workaround for searching multiple variants on the same phone field?
Yeah, I understand, making multiple API calls would be really inefficient in my use case. I really need a solution that can handle all variants in a single API call.
what I usually do in integration projects is, to look into data validation and format.
That’s basically the next level - a company eventually needs to move to clean / defined data.
If the source system doesn’t permit this, I’d usually create “translation” workflows to take messy data, transform it into a standard format and save it in the target system.
Works fairly well - especially for phone / mobile integrations - in multiple projects.
Overall, that’s usually more an organisational problem than a technical. If you talk to sales / marketing / customer service, there are probably solutions that can be worked out.
If you can’t get clean data working whatsoever over the whole systems and your company doesn’t want to invest in cleaner data, that becomes an IT project with a budget.
Then you could implement a custom API point to query your data in your described manner.
You could also look into GraphQL
and see whether you can get this to work via that API.