New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
7.11.4,Database failure when filter custom fields by V8 API #7285
Comments
I check #6455 , this issue had been fixed , but i test it and don't work, I don't understand it. |
Hi there, I could not replicate this, is there any additional information you could provide which could lead to us replicating this so we can get this fix for your issue. Thanks, |
SuiteCRM version 7.11.5 Response: Logs: mysql> SHOW columns FROM accounts; mysql> SHOW columns FROM accounts_cstm; |
AND jt4.deleted=0 LEFT JOIN accounts jt5 ON accounts_cstm.account_id_c = jt5.id AND jt5.deleted=0 LEFT JOIN accounts jt6 ON accounts_cstm.account_id_c = jt6.id AND jt6.deleted=0 where (accounts.billingcity_c = Seattle' AND accounts.deleted = '0') AND accounts.deleted=0: MySQL error 1054: Unknown column 'accounts.billingcity_c' in 'where clause' As written from the logs: Corrected: |
Another example from the logs. |
I tested a few things, and I am fairly confident that, in this case, "accounts_cstm" should be returned by $bean->getTableName() on line 66 of Filter.php for this to work correctly. I am just unsure why it is not happening. |
Today I found the same error on Contacts module trying to filter on a custom field. Also, I've got the same conclussion as @nathanle about where the error should be fixed. ¿Is there a plan to fix it on next release? |
I just bumped up against this issue on the "Leads" module while attempting to filter on a custom field. @Dillon-Brown @cameronblaikie What are you looking for as far as information? |
This should be plenty of information to go on, marked as a bug. Thanks! |
@Dillon-Brown @cameronblaikie I'm still having the same issue. Is there any plans to solve this |
Same here :-( I can confirm the bug is still present on 7.11.8 - I have it on 2 separate installations. Just tested it few mins ago:
|
@cduquev @jan-waterdrop
|
Can someone confirm if there is a commit to this issue that has fixed it? |
@ahmed-cader I don't see any fix related to this issue, probably there is none... :-( |
Not a very proper solution, but a quick and very dirty workaround: add some helper functions in the same file
And wait for a proper fix |
The dirty workaround solves my life in 7.11.9. Pls. resolve the issue |
Why is the fix called "dirty", what is it lacking to be a "proper fix"? I'm just asking because if nobody makes the PR this will likely get stalled... |
Because I don`t know the impact. |
One impact I've seen. When using filter with custom field and page options, the total amount pages is always 0. |
Works like a charm! Thank You!!!! |
Can anyone mitigate the impact the @Lehnerr mentioned above? |
Worked fine in 7.11.1 |
This issue has been re-confirmed to exist and is replicable in the latest 7.10.x version. While filtering for a custom field (Only via API is this issue observed) a "Database failure. Please refer to suitecrm.log for details." error Thanks 👍 |
Issue on 7.11.13, too. Fix works |
Hi. I Found a solution that is in a way "propper" and involves fixing the API V8/JsonApi/Repository/Filter.php which itterrates over the filters passed in the body of the Request. Inside it only needs to check the fields_defs definition for each field to see if it has 'source' set to 'custom_fields' which indicates the field is of type custom and exists inside the modules '_cstm' table. Update this method on line 37 inside the file V8/JsonApi/Repository/Filter.php.
Hope this helps. |
This fixes the filter by api. But in suitecrm.log I see that the same error keeps getting Wed Jan 13 15:33:12 2021 [25916][1][FATAL] Mysqli_query failed. How could I solve it? |
Hi. Problem still exists in 7.11.18, I've applied above fix and it works, not sure if there are any side effects. |
broken for me |
Using CRM v7.12.1 Got this error on every api request I do : Here is my url request for you to understand : So im looking if this Siren (French ID of a company) already exist in my CRM. The code is working well. But I have this error log on every API request ... Ofc siren_c exist in my CRM, I've checked in my database. |
This issue has been mentioned on SuiteCRM. There might be relevant details there: https://community.suitecrm.com/t/unable-to-filter-with-custom-fields/83969/4 |
Just as info, I still have those line on every API request with a filter on 7.12.5 .... |
About the "SELECT COUNT(*) AS cnt" error that keeps rising with custom fields in filter, it is related to countRecords function which do no verify if a module has custom fields. The following should resolve the issue:
I guess we could probably found a better way to find out if a module has custom fields. So comments are welcome! Edit: Actually another open issue is dealing with the subject: |
Issue
Expected Behavior
Actual Behavior
Possible Fix
Steps to Reproduce
SuiteCRM/Api/V8/module/Accounts?filter[operator]=and&filter[xx_c][eq]=431565
{ "errors": { "status": 400, "title": null, "detail": "Database failure. Please refer to suitecrm.log for details." } }
: MySQL error 1054: UNKNOWN COLUMN 'accounts.xxx_c' IN 'where clause'
SELECT accounts.*, accounts_cstm.jjwg_maps_lng_c, accounts_cstm.jjwg_maps_lat_c, accounts_cstm.jjwg_maps_geocode_status_c, accounts_cstm.jjwg_maps_address_c, accounts_cstm.cust_full_name_c, accounts_cstm.domain_c, accounts_cstm.egdelivery_c, accounts_cstm.egselecteddistributor_c, accounts_cstm.groupemail_c, accounts_cstm.hpe_dba_cust_name_c, accounts_cstm.hpe_fse_c, accounts_cstm.hpe_isr_c, accounts_cstm.hpe_legal_name_c, accounts_cstm.hp_loc_id_c, accounts_cstm.hybriditspecialist_c, accounts_cstm.mastercustno_c, accounts_cstm.pr_directresponse_c, accounts_cstm.pr_eg_service_provider_spec_c, accounts_cstm.pr_ntwkg_wirelesslan_spec_c, accounts_cstm.pr_ntwrk_campus_switch_c, accounts_cstm.pr_service_specialist_c, accounts_cstm.snx_cust_no_c, accounts_cstm.snx_sales_terr_c, accounts_cstm.verticalmkt_c, jt0.user_name modified_by_name, jt0.created_by modified_by_name_owner, 'Users' modified_by_name_mod, jt1.user_name created_by_name, jt1.created_by created_by_name_owner, 'Users' created_by_name_mod, jt2.user_name AS signed_user_name, jt2.created_by AS signed_user_name_owner, 'Users' AS signed_user_name_mod, jt3.name parent_name, jt3.assigned_user_id parent_name_owner, 'Accounts' parent_name_mod, jt4.name campaign_name, jt4.assigned_user_id campaign_name_owner, 'Campaigns' campaign_name_mod FROM accounts LEFT JOIN accounts_cstm ON accounts.id = accounts_cstm.id_c LEFT JOIN users jt0 ON accounts.modified_user_id = jt0.id AND jt0.deleted = 0 AND jt0.deleted = 0 LEFT JOIN users jt1 ON accounts.created_by = jt1.id AND jt1.deleted = 0 AND jt1.deleted = 0 LEFT JOIN users jt2 ON accounts.assigned_user_id = jt2.id AND jt2.deleted = 0 AND jt2.deleted = 0 LEFT JOIN accounts jt3 ON accounts.parent_id = jt3.id AND jt3.deleted = 0 AND jt3.deleted = 0 LEFT JOIN campaigns jt4 ON accounts.campaign_id = jt4.id AND jt4.deleted = 0 AND jt4.deleted = 0 WHERE (accounts.xx_c = '431565' AND accounts.deleted = '0') AND accounts.deleted = 0 LIMIT 0,50;
Context
Your Environment
The text was updated successfully, but these errors were encountered: