Results 1 to 9 of 9

Thread: Tips & Tricks - Custom Activity Status Dropdowns

  1. #1
    matthew's Avatar
    matthew is offline Sugar Team Member
    Join Date
    Jul 2005
    Posts
    533

    Default Tips & Tricks - Custom Activity Status Dropdowns

    Here's a common problem we get at support, so I decided to write something about it, I hope it helps people.

    When ever you create custom dropdowns in the status section for calls and meetings, the coded business logic doesn't look for your custom statuses. Even if it did, it wouldn't know whether it was a HISTORY item or an ACTIVITIES item in the subpanel.

    The Result? Your meetings and calls aren't displayed in the activities or history subpanel when you assign them a status other than the "out of the box" values.

    Also, they won't show up on the home page.

    There is an easy fix and here's a quick explanation of it:

    Custom status dropdowns

    Dropdowns are arrays that contain KEYS and VALUES. The KEY of a dropdown is what is inserted into the database and thus is intergral to the logic of SugarCRM.

    VALUES of a dropdown are arbiturary and only for the display on the screen.

    If new KEYS and VALUE are added to a dropdown, often business logic is disrupted and the KEY needs to be added to the underlying code to query the database to produce the expected results.

    EXAMPLE 1.: Adding a new status to Calls

    If a new KEY and VALUE are added to the 'call_status_dom' dropdown; SugarCRM will need to be modified to accomidate the new KEY.

    For example, if we add 'Voicemail' to call_status_dom a custom array - the array with the keys and values will be added to ./custom/include/language/en_us.lang.php (or the language in question). See the below example of the custom language file array:

    PHP Code:
    <?php
    $app_list_strings
    ['call_status_dom'] = array (
    'Planned' => 'Planned',
    'Held' => 'Held',
    'Voicemail => 'Voicemail,
    'Not Held' => 'Not Held',
    );
    ?>
    Now we must add the new STATUS to the business logic. First we must determine if this is going to be apart of the ACTIVITIES subpanel or the HISTORY Subpanel. For this example, I will make it apart of the Activities SubPanel - but the process is nearly identical for History SubPanel.

    Go to ./modules/Calls/subpanel/ForActivities.php, in the array $subpanel_layout find the sub-array that looks like this:
    PHP Code:
    'where' => "(calls.status='Planned')"
    And change to fit new business logic, like this:
    PHP Code:
    'where' => "(calls.status='Planned' OR calls.status='Voicemail')"
    The steps are identical for ./modules/Calls/subpanel/ForHistory.php

    Finally, to ensure that this appointment appears on the HOME page under "Upcoming Appointments", the following code must be altered as well:

    In order to we must add the following line to the ./modules/Activities/config.php file

    PHP Code:
    $open_status[] = "Voicemail"
    This will load up the $open_status array with values.

    These values for $open_status should match the "open" status you create for meeting_status_dom and call_status_dom.

  2. #2
    heathsanchez is offline Member
    Join Date
    Aug 2007
    Posts
    5

    Default Re: Tips & Tricks - Custom Activity Status Dropdowns

    Hi Matthew!

    Thanks for the helpful advice.

    Just wondering if you could tell me how to make Tasks with Custom Status Dropdowns appear in the My Open Tasks Dashlet?

    Thanks in advance!

  3. #3
    vishwasrao's Avatar
    vishwasrao is offline A Prolific Poster
    Join Date
    Sep 2008
    Location
    Pune,Maharashtra,India
    Posts
    385

    Smile Re: Tips & Tricks - Custom Activity Status Dropdowns

    Thanx matthew,
    Great work ,

    Should this procedure is same for any custom dropdowns & for any custom field because i am going to add custom fields of type dropdown in activities of leads module.
    Reply me as early as possible.
    Thanx in advance.

  4. #4
    heta's Avatar
    heta is offline Sugar Community Member
    Join Date
    Nov 2007
    Location
    Ahmedabad,India
    Posts
    214

    Default Re: Tips & Tricks - Custom Activity Status Dropdowns

    Thanks matthew,

    That helped me a lot.

    For other users who want to checkout upgrade safe solution please visit this.
    Best Regards
    ---------------------------------------
    Heta Shah - iNET PROCESS
    heta.shah@inetprocess.com
    http://www.inetprocess.co.in
    Projects :
    iNETDocs -Project of the month(Dec-2008)
    iNETGoogleMap

  5. #5
    skyglassinc is offline Member
    Join Date
    Oct 2009
    Posts
    17

    Default Re: Tips & Tricks - Custom Activity Status Dropdowns

    Thanks Matthew,

    not only did this help, but it showed right up in Google first thing for "sugarcrm accounts activities custom status".

    Will we need to remove this custom code before upgrades and patches and then reapply it?

    EDIT: The files you're pointing to don't seem to exist in 5.2. Where do I put this code now?

    It looks like I should modify this line in modules/activities/subpanelview.php:
    Code:
    foreach ($focus_calls_list as $call) {
    	if ($call->status != "Planned") {
    but the syntax is different, how do I add other statuses to this code?
    Last edited by skyglassinc; 2009-11-23 at 08:13 PM. Reason: found more info

  6. #6
    leemoney24 is offline Sugar Community Member
    Join Date
    Feb 2006
    Posts
    56

    Default Re: Tips & Tricks - Custom Activity Status Dropdowns

    To resolve in 5.2.0...follow these steps.

    Go to /modules/Tasks/metadata/subpanels
    Edit ForActivities.php

    Find line
    Code:
     'where' => "(tasks.status='Not Started' OR tasks.status='In Progress' OR tasks.status='Pending Input')",
    Change to
    Code:
    'where' => "(tasks.status='Not Started' OR tasks.status='In Progress' OR tasks.status='Pending Input' OR tasks.status='Custom Status 1' OR tasks.status='Custom Status 2' )",
    this worked for me...and I'm sure it's not upgrade safe
    Last edited by leemoney24; 2010-02-02 at 04:45 PM.

  7. #7
    skyglassinc is offline Member
    Join Date
    Oct 2009
    Posts
    17

    Default Re: Tips & Tricks - Custom Activity Status Dropdowns

    Thanks!

    I ended up just making custom "direction" dropdowns to note the status of the calls, which works fine except they don't show up in the (completely resistant to any customization) activities subpanel.

  8. #8
    kblackwell is offline Sugar Community Member
    Join Date
    Jul 2008
    Posts
    69

    Default Re: Tips & Tricks - Custom Activity Status Dropdowns

    matthew,

    Worked perfectly. Thanks for the example. You the man!!!!!

  9. #9
    samson smith is offline Sugar Community Member
    Join Date
    Sep 2011
    Posts
    37

    Default Re: Tips & Tricks - Custom Activity Status Dropdowns

    Very nice!! thanks for this useful advice!!

Thread Information

Users Browsing this Thread

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

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
  •