Results 1 to 5 of 5

Thread: Fetching value from relate field

  1. #1
    kshaw661 is offline Member
    Join Date
    Jan 2011
    Location
    India
    Posts
    19

    Default Fetching value from relate field

    When i am fetch the data from relate module then some values are come and some are not.
    I cant understand why please help me.
    my code is
    array (
    'name' => 'reporting_to_manager_c',
    'studio' => 'visible',
    'label' => 'LBL_REPORTING_TO_MANAGER',
    'displayParams' =>
    array (
    'field_to_name_array' =>
    array (
    'id' => 'a1234_managers_id_c',
    'name' => 'reporting_to_manager_c',
    'designation_c' => 'manager_des_c',
    'phone_mobile' => 'mobileno_c',
    'manager_code_c' => 'managercode_c',
    'alt_number_c' => 'alt_no_c',
    ),
    ),

    Here the designation_c and
    alt_number_c is not comming
    why
    plese help me
    as soon as possible
    Thank you
    Kunal

  2. #2
    rafael.q.g@hotmail.com's Avatar
    rafael.q.g@hotmail.com is offline Sugar Community Member
    Join Date
    Jun 2011
    Location
    Florianópolis - Brazil
    Posts
    782

    Default Re: Fetching value from relate field

    A way that I know to display fields from related modules is like in this exemple:
    Create a file named: custom/Extension/modules/<MODULE_NAME>/Ext/Vardefs/<ANY_NAME>.php, then input some code like that:
    PHP Code:
    <?php
    $dictionary
    ["Account"]["fields"]["contact_office_phone"] = array (
        
    'name' => 'contact_office_phone',
        
    'type' => 'relate',
        
    'source' => 'non-db',
        
    'rname' => '<REPLACE_THE_FIELD_NAME_OF_CONTACT_MODULE>'// phone_work
        
    'id_name' => '<REPLACE_YOUR_RELATE_FIELD_NAME>'// in my case, contact_id_c
        
    'vname' => 'LBL_CONTACT_OFFICE_PHONE'// change appropriate label and put the label in language file
        
    'type' => 'relate',
        
    'link'=> 'contacts_link',
        
    'table' => 'contacts',
        
    'isnull' => 'true',
        
    'module' => 'Contacts',
        
    'dbType' => 'varchar',

        );
    $dictionary["Account"]["fields"]["contacts_link"] =
      array (
        
    'name' => 'contacts',
        
    'type' => 'link',
        
    'relationship' => 'accounts_contacts_rel',
        
    'module'=>'Contacts',
        
    'bean_name'=>'Contact',
        
    'source'=>'non-db',
            
    'vname'=>'LBL_CONTACTS',
      );

    $dictionary["Account"]["relationships"]["accounts_contacts_rel"] = // make sure relationship name is unique
      
    array('lhs_module'=> 'Contacts''lhs_table'=> 'contacts''lhs_key' => 'id',
      
    'rhs_module'=> 'Accounts''rhs_table'=> 'accounts_cstm''rhs_key' => '<REPLACE_YOUR_RELATE_FIELD_NAME>'// in my case, contact_id_c
      
    'relationship_type'=>'one-to-many');
    Then you can repeat this for each custo field which you want to display. In this code exemple, the field that goes to be displayed in layouts is "contact_office_phone". May you can try this adapting for your case.
    Rafael Queiroz Gonçalves
    Advanced OMG UML Certified Professional
    Sun Certified Enterprise Architect for the Java Platform
    Sun Certified Programmer for the Java 2 Platform
    IBM Certified Advanced Application Developer - Lotus Notes and Domino
    IBM Certified Application Developer - IBM WebSphere Portlet Factory
    Computer Science Mastering / UFSC - PPGCC

  3. #3
    Kupido is offline Sugar Community Member
    Join Date
    Apr 2011
    Posts
    60

    Default Re: Fetching value from relate field

    Hello

    short question
    i want the value from email adress and telephonenumber from users module to fields in Contacts.
    Where can i get the id from this fields?

    and your code i insert to ....contacts/ect/vardefs....?

    thx best regards

  4. #4
    rafael.q.g@hotmail.com's Avatar
    rafael.q.g@hotmail.com is offline Sugar Community Member
    Join Date
    Jun 2011
    Location
    Florianópolis - Brazil
    Posts
    782

    Default Re: Fetching value from relate field

    the code has to be placed at:
    custom/Extension/modules/Contacts/Ext/Vardefs/<ANY_NAME>.php

    And you can get the ids/names of the users fields on:
    modules/users/vardefs.php
    Rafael Queiroz Gonçalves
    Advanced OMG UML Certified Professional
    Sun Certified Enterprise Architect for the Java Platform
    Sun Certified Programmer for the Java 2 Platform
    IBM Certified Advanced Application Developer - Lotus Notes and Domino
    IBM Certified Application Developer - IBM WebSphere Portlet Factory
    Computer Science Mastering / UFSC - PPGCC

  5. #5
    kshaw661 is offline Member
    Join Date
    Jan 2011
    Location
    India
    Posts
    19

    Default Re: Fetching value from relate field

    Thank You
    I make it easy for me
    Once again Thank You
    From
    Kunal

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-09-20, 04:59 PM
  2. Replies: 6
    Last Post: 2010-03-05, 12:38 PM
  3. Replies: 3
    Last Post: 2010-02-09, 05:45 AM
  4. Replies: 0
    Last Post: 2010-01-14, 02:56 PM
  5. relate Field -> Search Field
    By Mr.X in forum Developer Help
    Replies: 2
    Last Post: 2009-02-05, 07:04 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
  •