Issue with Exact Phone Number Match in Zoho CRM Search Record API

Issue with Exact Phone Number Match in Zoho CRM Search Record API

Hello Everyone,

I am working on a custom function that works as a REST API. This function receives API calls via a third-party webhook, where the payload data contains various details, including phone numbers, names, dates, etc. A single payload can contain data for multiple records.

I am extracting the phone number from the payload and then generating different combinations of possible phone number formats that are stored in the phone field within Zoho CRM. The phone numbers in Zoho CRM can be stored in various formats, such as:

+1 9876543210
019876543210
+19876543210

Using the searchRecord function, I am trying to search for leads records based on the phone number and associate the matching record. However, I am encountering an issue where the search results return records where the phone number partially matches (e.g., the first two or last two digits), in addition to exact matches. This causes incorrect associations with records.

I would like to get only exact matches. Below is the search query I am using:

lead_mobile_response = zoho.crm.searchRecords("Leads","(" + Phone+ ":equals:" + raw_number + ") or (" + Phone+ ":equals:" + number_with_zero + ") or (" + Phone+ ":equals:" + plus_c_code + ") or (" + Phone+ ":equals:" + plus_c_code_with_space + ") or (" + Phone+ ":equals:" + c_code_with_space + ") or (" + Phone+ ":equals:" + plus_c_code_with_dash + ") or (" + Phone+ ":equals:" + c_code_with_number + ") or (" + Phone+ ":equals:" + number_with_leading_zero_and_country_code + ") or (" + Phone+ ":equals:" + number_with_space_and_zero_prefix + ")");

Has anyone encountered this issue or can offer guidance on how to ensure that only exact matches are returned when using the equals operator?

Any insights or suggestions would be greatly appreciated.

Thank you!