display data stored in one module in another module

I have address field which is stored in accounts module while creating the account. Here what I want is this address field should reflect in all modules can any one clearly explain me about this query .thanks in advance.
  • --- You need to create the address field in all desired modules.
    (Copy address field defination from \cache\modules\Accounts\Accountvardefs.php and add in your module in upgrade safe manner Path \custom\Extension\modules\YourModule\Ext\Vardefs\yourAddressFied.php )

    After this hit Quick Repair and Rebuild and see address field is created.

    ---  Secondly after adding field you need to show field in editviewdefs.php,detailviewdefs.php.
     (For this copy address field(billing,shipping) arrays from \modules\Accounts\metadata\editviewdefs.php ,\modules\Accounts\metadata\detailviewdefs.php and add in your module's edit/deailviewdefs.php in upgrade safe manner Path :custom/modules/YourModule/metadate/editORdeailviewdefs.php)

    Waleed!
  • friend thanks for your reply but one thing I want tell you I have stored data in this address field where this data must be auto populate in all modules and i have also created one to many relationship from accounts to these all modules.friend please help me regarding this.
  • In which case you want to populate same data in all modules.like on lead conversion or on creation of some module record you want to create other modules record with same data? and why you want to add relationship? 
  • Friend I have created 2 custom modules they are Quotes and Contracts and have related them with accounts module.

     i.e I have created one to many relationship from accounts  to quotes and accounts to contract and also related accountid field with these modules.

     Now while creating new account i will enter the address feilds like address, city, state ,postal code and so on in accounts module and these field get stored in database.

     Infact i want these fields not to re enter in quotes or contract module i should get these values from accounts and display in quotes and contarct modules.i think your are clear now with this query.

     Please friend help me regarding this thank u very u much for you response.

  • First of all add addrees fields in quote and contract module as i have described in first reply.

    If i am not wrong you want to populate account's addrees field value into quote or contract when any contract or quote will be related to some account?
    So you want when in any contract or quote record you select account as relate field than that account's address field value should populate in contract/quote record?. Same as in contact you select account than contact's address field is populated automatically from selected accounts record (Test it in contact creation). 

    If you want exactly this than it can be achieved by Display Params. see \modules\Contacts\metadata\editviewdefs.php and find code
    array(
       array (
      'name' => 'account_name',
      'displayParams' =>
      array (
        'key' => 'billing',
        'copy' => 'primary',
        'billingKey' => 'primary',
        'additionalFields' =>
        array (
       'phone_office' => 'phone_work',
        ),
      ),
       ),
    ),

    You need to do the same No rocket sience everything is present in SugarCRM we just have to explore it.

    Waleed!
  • friend i didnt find this code in \modules\Contacts\metadata\editviewdefs.php or can add it in this file 

  • Check again file will be there.Also address field definition is present in Accounts module. Path \modules\Accounts\metadata\editviewdefs.php 
    But to copy the address while selection account in quote/contract module you need to write display params.

    Code to add address field
    ~~~~~~~~~~~~~~~
              array (
                'name' => 'primary_address_street',
                'hideLabel' => true,
                'type' => 'address',
                'displayParams' =>
                array (
                  'key' => 'primary',
                  'rows' => 2,
                  'cols' => 30,
                  'maxlength' => 150,
                ),
              ),

              array (
                'name' => 'alt_address_street',
                'hideLabel' => true,
                'type' => 'address',
                'displayParams' =>
                array (
                  'key' => 'alt',
                  'copy' => 'primary',
                  'rows' => 2,
                  'cols' => 30,
                  'maxlength' => 150,
                ),
              ),
    ~~~~~~~~~~~~~~~~~
    Code to use display param to fill address field of quote/contract on selection of account
    array (
                'name' => 'account_name',
                'displayParams' =>
                array (
                  'key' => 'billing',
                  'copy' => 'primary',
                  'billingKey' => 'primary',
                  'additionalFields' =>
                  array (
                    'phone_office' => 'phone_work',
                  ),
                ),
              ),
    ~~~~~~~~~~~~~~~~
  • Freind I have already added the field  in detail layout of quotes module and I want this address only in detail layout from accounts module which is already stored while creating a new account .I am bit confused still please can u clearly explain which code needs to put in which file and also i m not understanding this  'name' => 'account_name', what is this account_name what should i put instead of this account_name.
     and also this   'additionalFields' =>
                  array (
                    'phone_office' => 'phone_work',
                  ), instead of phone _office => 'phone_work' what should I use.please friend dont mind I am new to sugar crm.Your help will be very greatfull for me.Thank u very much for your kind response.