HOWTO: Custom Accounts dashlet that show records without related calls

Matthew Marum —  May 24, 2011 — 1 Comment

Here’s a great question that came out of the forums this week

Hey everyone,

I am trying to create a Dashlet that lists all Accounts that have no related Calls. In effect, I want to list all of the accounts that have never been called by our sales staff.

I have made many custom Dashlets before, but this is baffling me. Considering an account can have any number of calls related to it, I assume I would have to have some code that counts the number of related calls, and if this number == 0, then I can display this account record to the user in the dashlet list.

Is this even possible? How could I modify the overridden buildWhere() or process() functions for the generic dashlet? Is there someplace else I should be looking?

I am completely lost as to where to even begin. ANY help would be much appreciated.

Ben

I directed the poster to look at the overriding the process() method in that Dashlet’s class. After taking a look at the other examples we’ve done of this in the app ( modules/Calls/Dashlets/MyCallsDashlet/MyCallsDashlet.php is a good example ) the poster came back with a nice example of the code needed to do this, shown below:

All that’s needed is to set the various custom_ parameters that are passed to the ListViewSmarty class to add the extra query pieces needed to make this work.

Matthew Marum

Posts

Matt is the Lead Developer Advocate for SugarCRM Engineering. Previously he was an Engineer on Sugar 7 and a Solutions Architect for the OEM program. He is also an avid trail runner, Boston Marathon qualifier and a karaoke aficionado.

One response to HOWTO: Custom Accounts dashlet that show records without related calls

  1. 

    Hi John
    with the fabtools of david boris on sugarforge, i have make a custom dashlet for “not followed accounts”. The SQL is a great tutorial.

    http://www.sugarcrm.com/forums/showthread.php?t=72024&highlight=accounts 
    Maybe, how to add a search criteria for “last X month” will be great.

    Cheers.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s