Results 1 to 2 of 2

Thread: Dashlet Custom Query

  1. #1
    Softbless is offline Senior Member
    Join Date
    May 2010
    Posts
    25

    Default Dashlet Custom Query

    Hi Guys,

    I make a custom field birthdate for SugarCRM in Accounts Module. And I want to display it in My Accounts Dashlet in HOME page.

    And I succeeded by edit and add this code in include\Dashlets\DashletGeneric.php :

    $widgetClass = $this->layoutManager->getClassFromWidgetDef($widgetDef, true);
    // $widgetDef['table'] = $this->seedBean->table_name;
    // $widgetDef['table_alias'] = $this->seedBean->table_name;
    /** [eggsurplus] 2009/01/06 - support custom fields in dashlets */
    if(isset($this->seedBean->field_defs[$name]['source']) && $this->seedBean->field_defs[$name]['source']=='custom_fields'){
    $widgetDef['table'] = $this->seedBean->table_name.'_cstm';
    $widgetDef['table_alias'] = $this->seedBean->table_name.'_cstm';
    }else{
    $widgetDef['table'] = $this->seedBean->table_name;
    $widgetDef['table_alias'] = $this->seedBean->table_name;
    }

    and add these lines into modules\Accounts\Dashlets\MyAccountsDashlet\MyAcco untsDashlet.data.php :
    'birthdate_c' => array('default' => ''),

    AND :

    'birthdate_c' => array( 'width' => '5',
    'label' => 'LBL_BIRTHDATE',
    'default' => true
    ),

    And it's working fine. But the problem is : I want to the dashlet to show all acounts that have birthdate today, so I need just to consider the date and month to today's date. Currently it's considering the date, month AND year to filter.

    For that, I need to have custom query for this particular dashlet.

    Where and how should I put the custom query?

    Any help would be very appreciated guys.

  2. #2
    davidboris is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    1,113

    Default Re: Dashlet Custom Query

    Hi,

    You can modify the query in file modules/Accounts/Dashlets/MyAccountsDashlet/MyAccountsDashlet.php

    Add custom_where

    PHP Code:
    $lvsParams['custom_where'] = "YOUR CONDITION"
    Thumbs up.

    Skype ID - david__boris

    SugarForge Projects:

    WYSIWYG now in studio!(Version 1.1 is out now!)

    Sugar Feeds on your personalized home pages like iGoogle, My Yahoo!, etc.

    Fab Tools! > Dashlet Not Followed Opportunities for past six Months

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How To: Use a custom query in a dashlet
    By eggsurplus in forum Developer Tutorials
    Replies: 7
    Last Post: 2011-01-19, 11:35 PM
  2. problem in Dashlet custom query
    By sivakumar.bdu in forum Developer Help
    Replies: 1
    Last Post: 2009-10-04, 11:02 AM
  3. Dashlet custom query not working
    By sivakumar.bdu in forum Help
    Replies: 2
    Last Post: 2009-10-02, 10:43 AM
  4. Replies: 0
    Last Post: 2009-06-15, 10:56 AM
  5. Dashlet Query
    By sacramentojoe in forum Help
    Replies: 0
    Last Post: 2006-12-08, 05:32 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •