Results 1 to 5 of 5

Thread: Global custom field

  1. #1
    fredlee is offline Junior Member
    Join Date
    Aug 2007
    Posts
    1

    Default Global custom field

    Thanks for a fantastic application.

    Running SugarCRM Open Source Version 4.5.1e (Build 1049).

    Is it possible to create "global custom fields"?
    I have created three custom fields in the Account module called "Assign to project 1 [-3]" to allow us to filter accounts on our three different projects.

    I would like add this data to the Contacts, Opportunites and Leads modules so that in each module I can see which project the Contact, Opp, Lead belong to. Only editable in the Accounts module.

    Regards,
    Fredrik

  2. #2
    batoski is offline Member
    Join Date
    Oct 2007
    Posts
    7

    Default Re: Global custom field

    Quote Originally Posted by fredlee
    Thanks for a fantastic application.

    Running SugarCRM Open Source Version 4.5.1e (Build 1049).

    Is it possible to create "global custom fields"?
    I have created three custom fields in the Account module called "Assign to project 1 [-3]" to allow us to filter accounts on our three different projects.

    I would like add this data to the Contacts, Opportunites and Leads modules so that in each module I can see which project the Contact, Opp, Lead belong to. Only editable in the Accounts module.

    Regards,
    Fredrik
    Hello,
    I have the same problem, did you find a way to resolve it ?

  3. #3
    MatR is offline Sugar Community Member
    Join Date
    Jul 2007
    Location
    Paris, France
    Posts
    311

    Default Re: Global custom field

    Hi fredlee,

    Did you thought using subpanels to do this? They create a relationship with your projects.
    Mathieu Rodrigues
    Consultant CRM
    CARRENET - SugarCRM Gold Partner
    >>> Suivez notre actualité sur Twitter ! http://twitter.com/carrenet

  4. #4
    kuske's Avatar
    kuske is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    Germany
    Posts
    2,597

    Default Re: Global custom field

    One simple idea, which is upgradable:

    1. Define the global custom field in each module it is needed with same definitions.

    2. For each module write a so called logic_hook, to load the values of the global field afer each database retrieve.
    Take care that the 3 modules have different module/class names, eg. OpportunitiesVerify, LeadsVerify and ContactsVerify,

    Example: global field key_account_c, set in accounts, used in opportunities:

    file custom/modules/Opportunities/logic_hooks.php:

    PHP Code:
    <?php
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    $hook_version 1;
    $hook_array = Array();
    // position, file, function
    $hook_array['after_retrieve'] = Array();
    $hook_array['after_retrieve'][] = Array(1'OpportunitiesVerify''custom/modules/Opportunities/OpportunitiesVerify.php','OpportunitiesVerify''MyCheckValues');
    ?>
    file custom/modules/Opportunities/OpportunitiesVerify.php:

    PHP Code:
    <?php
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    class 
    OpportunitiesVerify {
          function 
    MyCheckValues(& $focus$event$arguments){
    // ---------------------------------------------------------------------------------------------
             
    if($event=="after_retrieve"){
    // ---------------------------------------------------------------------------------------------
                
    $db = & PearDatabase::getInstance();
                
    $query "SELECT key_account_c, region_c FROM accounts_cstm WHERE id_c='$focus->account_id';";
                
    $result $db->query($querytrue,"Error fetching key_account_c: ");
                
    $row $db->fetchByAssoc($result);
                if(
    $row != null) {
                  
    $focus->key_account_c $row['key_account_c'];
                }
                
    $GLOBALS['log']->DEBUG("KA:".$focus->key_account_c);
             }
    // ---------------------------------------------------------------------------------------------
    //       end if logic hook is after_retrieve
    // ---------------------------------------------------------------------------------------------
          
    }
    //end class OpportunitiesVerify.php
    }
    ?>
    In WIKIpages you get more information to logic_hooks.

    3. Add the new field to the DetailViews of the 3 modules.



    best regards
    hk

  5. #5
    claudius139 is offline Member
    Join Date
    Oct 2007
    Posts
    6

    Default Re: Global custom field

    Is there a way to do the same thing with a module created with the new module builder???

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. custom field to sugar field
    By tanhaa in forum Developer Help
    Replies: 2
    Last Post: 2011-05-04, 03:52 PM
  2. Custom Field add not visible is Edit Layout
    By tylerpoint in forum Help
    Replies: 0
    Last Post: 2007-07-09, 05:56 AM
  3. Asterisk Patch 1.1.0 Crash on logon
    By skyracer in forum Help
    Replies: 6
    Last Post: 2006-07-08, 06:30 AM
  4. Replies: 7
    Last Post: 2006-06-06, 07:56 PM
  5. Custom Field Issue still lingering
    By rengstrom in forum General Discussion
    Replies: 9
    Last Post: 2005-06-07, 07:37 AM

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
  •