Make a quick vote 🗳 ️How do you refer to SuiteCRM extensions: add-ons or plug-ins? Click here to have your say 👈

How can I customise listview data coming in?

I would like to add a where clause to the data shown in the list view, where the status of the call is open will be only shown. How can I add this?

Thanks

Would you like to apply an automatic and unconditional filter for only open Calls?

Yes correct, I want to show only the calls from the open status and then the user can detailview into the call and close it. Once closed it will not show in the list. So I need to add a WHERE statement. But not sure where to add. It is not a custom module.

The easiest way, without coding, is to create a saved filter.

image

Thank you for the answer, however I didn’t want to let the user choose this filter. I can code if you can guide me a bit on what exact query or function to tweak.

This could be achieved by adding an ‘after login’ logic hook.

This logic hook will trigger a function when a user logs into the system, which will add the filter to the module specified in the triggered function. Please find the image attached:

This function can be customized as per the need and the code that is highlighted will actually add the filter in the database. The highlighted code can be customized as per requirements to filter the records by where clause. In the query, the ‘status advanced’ is the field name we want to filter upon and the value contains the field value the module key contains the name of the module on which the records must be filtered in the list view. So in this example, the list view for the meetings module will be customized to show the records that have the status ‘Planned’, and the assigned user for the meeting is the currently logged-in user.

1 Like

Okay let me try this, thank you.

Sure, let me know if it works!

Hi @Rolustech it seems like not working. This is the code.


what worked for me is
in the custom listview

I added this

function listViewProcess() {

        global $current_user;
        $this->processSearchForm();
        $this->params['custom_where'] = ' AND calls_cstm.interaction_status_c = "Open" AND calls.direction = "Inbound" ';

        if (empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false) {
            $this->lv->setup($this->seed, 'include/ListView/ListViewGeneric.tpl', $this->where, $this->params);
            $savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' . $_REQUEST['saved_search_select_name']);
            echo $this->lv->display();
        }
    }
1 Like