Results 1 to 3 of 3

Thread: Last Account Activity Dashlet

  1. #1
    hotquik is offline Sugar Community Member
    Join Date
    Nov 2009
    Posts
    17

    Default Last Account Activity Dashlet

    Hello, I am trying to create a Dashlet wich will show me my accounts and the date of the last activity (task, call or meeting) related to this account. I made a copy of the MyAccounts dashlet and started modifying what I needed.

    this is the process function:

    function process($lvsParams = array()) {

    if (isset($this->displayColumns) && array_search('lastActivityDate', $this->displayColumns) !== false) {
    $lvsParams['custom_select'] = ', lastActivityDate';
    $lvsParams['custom_from'] =
    "

    LEFT OUTER JOIN
    (
    SELECT
    parent_id,
    date_start as lastActivityDate,
    name as lastActivityName,
    lastActivityUserId,
    lastActivityUserName
    FROM
    (
    SELECT name, act.date_start,
    act.parent_id, act.parent_type, assigned_user_id
    FROM activities act,
    (SELECT parent_id, parent_type, MAX(date_start) date_start
    FROM activities
    GROUP BY parent_id, parent_type
    ) last_act
    WHERE act.date_start = last_act.date_start AND
    act.parent_id = last_act.parent_id AND
    act.parent_type = last_act.parent_type AND
    act.parent_type = 'Accounts'
    ) last_activity
    LEFT OUTER JOIN (SELECT id as lastActivityUserId, user_name lastActivityUserName FROM users) uact
    ON last_activity.assigned_user_id = uact.lastActivityUserId
    ) last_activity
    ON accounts.id = last_activity.parent_id

    ";

    }
    parent:: process($lvsParams);
    }
    }




    The generated query works exactly as needed, it returns the data from the account plus the date of the last activity.

    So far, I can add my dashlet to my home screen, the dashlet shows the account's data, but the new column lastActivityDate is empty on the dashlet. I did some debugging and this problem seems to be because this column its not defined in the Accounts fields.

    Can please someone help me with this ?

    Edit:

    I am using CE 5.5.1
    Last edited by hotquik; 2011-08-29 at 02:10 PM.
    » Operating system type and version: Windows 2003 Server
    » Sugar version and edition: 5.5.1 Community Edition
    » Webserver type and version: IIS 6
    » PHP version: 5.2.11
    » MS SQL server 2008 version

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

    Default Re: Last Account Activity Dashlet

    Hello,

    You can create a non-db field in module Accounts, with same field name and try.
    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

  3. #3
    hotquik is offline Sugar Community Member
    Join Date
    Nov 2009
    Posts
    17

    Default Re: Last Account Activity Dashlet

    I added a dummy field def just before calling the parent process, and it seems to be working fine

    $this->seedBean->field_defs['lastActivityDate'] =
    array (
    'name' => 'lastActivityDate',
    'vname' => 'lastActivityDate',
    'type' => 'datetime',
    'group' => 'lastActivityDate',
    'comment' => 'Last Activity Date'
    );

    }


    parent:: process($lvsParams);
    » Operating system type and version: Windows 2003 Server
    » Sugar version and edition: 5.5.1 Community Edition
    » Webserver type and version: IIS 6
    » PHP version: 5.2.11
    » MS SQL server 2008 version

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 2010-05-31, 09:53 AM
  2. Account Dashlet bug - how to solve it?
    By modlib in forum Help
    Replies: 3
    Last Post: 2009-11-27, 03:18 PM
  3. Replies: 1
    Last Post: 2008-04-10, 03:36 PM
  4. Account Stale Activity Report
    By asulgrove in forum Help
    Replies: 3
    Last Post: 2007-05-21, 01:27 PM
  5. Lead Dashlet - add account
    By 3v3ntiq in forum Feature Requests
    Replies: 2
    Last Post: 2006-09-25, 11:00 PM

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
  •