Is there anything I need to check or configure to make sure that the search will work? By search I am not referring to global search but instead on the basic and advance search for the module.
Is there anything I need to check or configure to make sure that the search will work? By search I am not referring to global search but instead on the basic and advance search for the module.
Can you elaborate on what happens when you try to perform a search?
Have you checked the sugarcrm.log file to see if you are getting any errors?
Can you elaborate on what happens when you try to perform a search?
Have you checked the sugarcrm.log file to see if you are getting any errors?
Hello Angel Magana,
When I try to do basic or advance search it just reloads the page like it did try to search but it failed to do so.
Also, I did what you mentioned and checked the logs and this is what I found when comparing my working search on the invoice module and the search for my custom module:
Sun Nov 6 23:56:41 2016 [27260][1][INFO] List View Where Clause: (cb_supporttickets.name like 'test 1%') AND jt0.deleted=0 LEFT JOIN users jt1 ON cb_supporttickets.assigned_user_id=jt1.id AND jt1.deleted=0 AND jt1.deleted=0 where (cb_supporttickets.created_by = '1') AND cb_supporttickets.deleted=0 ORDER BY cb_supporttickets.cb_supporttickets_number Start: 0 count: 21 Sun Nov 6 23:56:41 2016 [27260][1][INFO] Query: SELECT cb_supporttickets.id , cb_supporttickets.created_by , cb_supporttickets.assigned_user_id , cb_supporttickets.cb_supporttickets_number , cb_supporttickets.name , jt0.user_name created_by_name , jt0.created_by created_by_name_owner , 'Users' created_by_name_mod, cb_supporttickets.department , cb_supporttickets.status , cb_supporttickets.priority , cb_supporttickets.resolution , jt1.user_name assigned_user_name , jt1.created_by assigned_user_name_owner , 'Users' assigned_user_name_mod FROM cb_supporttickets LEFT JOIN users jt0 ON cb_supporttickets.created_by=jt0.id AND jt0.deleted=0 AND jt0.deleted=0 LEFT JOIN users jt1 ON cb_supporttickets.assigned_user_id=jt1.id AND jt1.deleted=0 AND jt1.deleted=0 where (cb_supporttickets.created_by = '1') AND cb_supporttickets.deleted=0 ORDER BY cb_supporttickets.cb_supporttickets_number LIMIT 0,21 Sun Nov 6 23:56:41 2016 [27260][1][INFO] Query Execution Time:0.00067806243896484
Here the where clause is wrong and it should be searching for the name and not using created_by
This is for the different module:
Mon Nov 7 05:07:19 2016 [19438][1][INFO] List View Where Clause: (aos_invoices.name like '1%' ) AND ( aos_invoices.id IN (SELECT favorites.parent_id FROM favorites WHERE favorites.deleted = 0 and favorites.parent_type = "AOS_Invoices" and favorites.assigned_user_id = "1") OR NOT (0)) Mon Nov 7 05:07:19 2016 [19438][1][INFO] Query:SELECT id, name FROM saved_search WHERE deleted = '0' AND assigned_user_id = '1' AND search_module = 'AOS_Invoices' ORDER BY name AND jt1.deleted=0 where ((aos_invoices.name like '1%' ) AND ( aos_invoices.id IN (SELECT favorites.parent_id FROM favorites WHERE favorites.deleted = 0 and favorites.parent_type = "AOS_Invoices" and favorites.assigned_user_id = "1") OR NOT (0))) AND aos_invoices.deleted=0 ORDER BY aos_invoices.number Start: 0 count: 21 Mon Nov 7 05:07:19 2016 [19438][1][INFO] Query: SELECT aos_invoices.id , aos_invoices.billing_account_id , aos_invoices.assigned_user_id , aos_invoices.number , aos_invoices.name , aos_invoices.status , jt0.name billing_account , aos_invoices.total_amount , aos_invoices.currency_id , aos_invoices.due_date , jt1.user_name assigned_user_name , jt1.created_by assigned_user_name_owner , 'Users' assigned_user_name_mod, aos_invoices.date_entered , aos_invoices.created_by FROM aos_invoices LEFT JOIN accounts jt0 ON aos_invoices.billing_account_id = jt0.id AND jt0.deleted=0 LEFT JOIN users jt1 ON aos_invoices.assigned_user_id=jt1.id AND jt1.deleted=0 AND jt1.deleted=0 where ((aos_invoices.name like '1%' ) AND ( aos_invoices.id IN (SELECT favorites.parent_id FROM favorites WHERE favorites.deleted = 0 and favorites.parent_type = "AOS_Invoices" and favorites.assigned_user_id = "1") OR NOT (0))) AND aos_invoices.deleted=0 ORDER BY aos_invoices.number LIMIT 0,21 Mon Nov 7 05:07:19 2016 [19438][1][INFO] Query Execution Time:0.00073909759521484
Here it is working as expected and is searching by name, but for the other module it was searching by created_by which was not the option I chose when searching.
What files should I be checking here as to why it defaulted on searching by created_by and not by name?
Nevermind I found the culprit it was a custom where added on view.list.php, I had to check every file for the module and found it. I just assumed no one touched the code. Thanks for all your tips everyone.