Best Practices: How can I create a Tabbed Dashlet filter by parent email address

I want to create a Tabbed Dashlet available on Contacts and Leads Detail Views with the following:

Contacts Tab, list all Contacts that share one or more email addresses with the record I'm on

Leads Tab, list all Leads that share one or more email addresses with the record I'm on

I tried to reverse engineer the "history" dashlet, which extends from the tabbed-dashlet.

However, the history dashlet retrieves records "linked" to the current record (direct relationships) and then applies additional filters that are hardcoded in the history.php metadata.
For example, the Meetings module with a "meetings" link to the current record are filtered by status:

           

'link' => 'meetings',
'module' => 'Meetings',
'filters' => array(

                'status' => array('$in' => array('Held', 'Not Held')),

            ),

I can remove the "link" parameter from the metadata for the tab, and the dashlet will retrieve ALL records for the "module" specified in the metadata, BUT I can't seem to find the best way to filter that massive collection by email address based on the email addresses on the current record...

Any thoughts on how to best proceed?

Am I trying to use the tabbed dashlet in an entirely unacceptable way?


Thanks,
FrancescaS

Parents
  • I would go for a custom api endpoint for this. You know which contact or lead you are on and you know which data you want to return ( records that share the same email addresses). That would be the easiest I think. You let the api do the heavy stuff. Only thing you need to worry about is paging and such but still that shouldn't be that hard. 

    If you look at the tabbed-dashlet.js file you can see that there is a _createCollection method. This retrieves a bean collection based on tab properties. So if you can find out which tab you need data for you can also retrieve the collection for it. 

    this is some basic idea I came up with. I hope it helps, when I have more time I will take a look and provide more details on how I would do it :) 

  • I thought about that, but was hoping to solve it the "lazy" way, leveraging the filters in the metadata. ;)

Reply Children