Results 1 to 2 of 2

Thread: How can I mirror a field in another modul?

  1. #1
    albert39 is offline Member
    Join Date
    Sep 2010
    Posts
    8

    Default How can I mirror a field in another modul?

    I am a CRM-newbie. I work with CRM Community Edition 5.5.0. (German version). Perhaps some expressions are not translated correctly.

    A user created modul (I call it MB) contains the informations of members in an organization. MB is related to Contacts. (See attachment). Contacts contains the basic information of a member (address, E-Mail etc.) and MB the informations related to the organization. A drop-down-field (I call it Member-Type) specifies a property of a member. This property is shown in the MB-List.

    It should also be shown in the Contacts-List.

    What is the procedure to copy (mirror) the content in a field of MB to a field of Contacts? Is that possible with a drop-down-field in MB?

    Thank you for your help.

    Albert
    Attached Images Attached Images  

  2. #2
    JackPK's Avatar
    JackPK is offline Sugar Community Member
    Join Date
    Mar 2010
    Location
    Guadalajara, Jalisco. Mexico
    Posts
    67

    Default Re: How can I mirror a field in another modul?

    Hi Albert,

    Please correct me if i'm wrong, what you need is to have the value of a drop down list from your custom module to the same list but in Contacts, right?

    Well, if thats the case, first you need to have the same list on both modules so the value can be homogeneous. then, you need to create a logic hook on your custom module so, after the record saves its info in the database, the hook can update the value on contacts, it'll look like this (kinda ):

    PHP Code:
    function mirror(&$bean$event$arguments
    {
         
    $db =  DBManagerFactory::getInstance();  
         
    $contactid $bean-> RELATE_WITH_CONTACTS//This is the ID of the contact related, the name of the field can be found on the VarDerf.php, inside /Custom/modules/your_module/metadata/Vardefs, it looks something like "module_key_module_name"
                
         
    $list_value $bean-> LIST_NAME//Value of your list on custom module

         
    $query 'UPDATE Contacts_cstm ' //This is where your custom list should be in the DB
                  
    .' SET list_c = "' $list_value .'" ' //This is the value of your list on your custom module that is going to your contacts field in the DB
                
    .' WHERE Contacts.id = "' $contactsid .'" ';
                
         
    $result $db->query($querytrue'Error on UPDATE');


    Remember to adjust the names of your DB fields and your vardefs, if you have troubles with this, feel free to ask

    Good luck Albert
    Jose A. Fuentes
    IT Specialist, Project Manager & SugarCRM Consultant
    Querétaro | Querétaro | Mexico
    p: +52 442-364-7187
    e: jafu.85@gmail.com

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 2009-08-17, 04:14 PM
  2. Modul für Zeiterfassung?
    By Escher in forum Deutsche
    Replies: 2
    Last Post: 2008-10-13, 12:19 PM
  3. Modul hochladen
    By DrMcCoy in forum Deutsche
    Replies: 3
    Last Post: 2008-08-08, 12:14 PM
  4. Modul gesucht!
    By psc in forum Deutsche
    Replies: 0
    Last Post: 2008-02-19, 03:51 PM
  5. Bug on Modul Loader
    By achenchah in forum Help
    Replies: 0
    Last Post: 2007-03-19, 04: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
  •