SuiteCRM API V8 Query error

I’m trying to connect SuiteCRM to 3CX trough Suite API.

So the first thing i try is to get search an contact by a phone number


Test it, the system gave

“errors”: {
“status”: 400,
“title”: null,
“detail”: “Database failure. Please refer to suitecrm.log for details.”
}Database failure. Please refer to suitecrm.log for details.

In the suitecrm.log i have

Mon Oct 12 20:57:37 2020 [][][FATAL] Mysqli_query failed.
Mon Oct 12 20:57:37 2020 [][][FATAL] Error retrieving Contact list: Query Failed: SELECT , contacts.assigned_user_id FROM contacts LEFT JOIN contacts_cstm ON = contacts_cstm.id_c where (contacts.phone_home = ‘XXXXXXXXX’ OR contacts.phone_mobile = ‘XXXXXXXXX’ OR contacts.phone_work = ‘XXXXXXXXX’ OR contacts.phone_other = ‘XXXXXXXXX’ OR contacts.deleted = ‘0’) AND contacts.deleted=0 LIMIT 0,-98: MySQL error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘-98’ at line 1

If i run the query manualy with 98 instead of -98, no errors found and with results.
Is there someone with same issue?


Are you still having issues with this?

As far as I’m aware, the Limit’s Offset is normally set by the “Listview items per page” value set in Admin->System Settings

So, a setting like

Returns a Query that ends in

 LIMIT 0,25

What value is set there for your CRM?
It would be worth checking what this value is set as, and perhaps changing it, to see if it has any effect

For anyone facing the same issue.

This still happen in SuiteCRM 7.13.3

Issue and suggested fixes is reported below

1 Like