I’m trying to display data from a non-Sugar table in a custom listview in SugarCRM. Currently I’m running an SQL query in a custom view.list.php file, but this is displaying the data below the list rather than replacing the default query in the listview.
How can I replace the default query in a listview with custom SQL?
I’ve managed to solve this by overriding the create_new_list_query() method in the module base class:
This method creates an SQL statement which is used in /includes/ListView/ListViewData.php. I’ve aliased the field names selected from the external table to match the names of the fields set up in Sugar (easier than creating or renaming every single field).