Auto populate fields when i select quotation

I'm fighting against this issue since a couple of weeks and I can't figure out a way to do that.

Because i am new to sugarcrm and development

I have created a custom module COF where i want to select the quotation then auto populate the fields(all fields from quotation) to COF. so how can i get the values easily from one module to another module.

1. Can we do this based on JS because i want to edit any field then i can edit before save.

2. is it possible with custom logic hook. before save the document.

Francesca Shiekh hatsVignesh V

 I really need help, as soon as possible.

Thank you

Parents
  • Hi Ash,

    You can use 'populate_list' property in vardef file of a quote relate field to auto populate the COF module fields based on related quote.

    For eg: if your vardef file is custom/Extension/modules/<COF_Module>/Ext/Vardefs/<cof_quote_file.php>

    $dictionary['<COF_Module>']['fields']['<quote_relate_name>']['populate_list']['name']='<field_in_cof_module>'; //populate quote name to <field_in_cof_module>
    $dictionary['<COF_Module>']['fields']['<quote_relate_name>']['populate_list']['description']='<field_in_cof_module>'; //populate quote description to <field_in_cof_module>

    Similarly, you can use this property to populate as many fields as you want from the related quote module.

    Let us know if this helps.

    Regards.

  • I have added these lines in relate field [created from studio to select quotation]. but fields are not auto populating

    custom/Extension/modules/COF_CustomerOrderForm/Ext/Vardefs/sugarfield_quotation_c.php

    <?php
    $dictionary['COF_CustomerOrderForm']['fields']['quotation_c']['labelValue']='Quotation';
    $dictionary['COF_CustomerOrderForm']['fields']['quotation_c']['dependency']='';
    $dictionary['COF_CustomerOrderForm']['fields']['quotation_c']['populate_list']['cof_customername_c']='billing_account_name';
    $dictionary['COF_CustomerOrderForm']['fields']['quotation_c']['populate_list']['contactname_c']='billing_contact_name';
    $dictionary['COF_CustomerOrderForm']['fields']['quotation_c']['populate_list']['billingaddress_c']='billing_address_street';
    $dictionary['COF_CustomerOrderForm']['fields']['quotation_c']['populate_list']['billingstate_c']='billing_address_state';
    $dictionary['COF_CustomerOrderForm']['fields']['quotation_c']['populate_list']['billingcountry_c']='billing_address_country';

    ?>

Reply
  • I have added these lines in relate field [created from studio to select quotation]. but fields are not auto populating

    custom/Extension/modules/COF_CustomerOrderForm/Ext/Vardefs/sugarfield_quotation_c.php

    <?php
    $dictionary['COF_CustomerOrderForm']['fields']['quotation_c']['labelValue']='Quotation';
    $dictionary['COF_CustomerOrderForm']['fields']['quotation_c']['dependency']='';
    $dictionary['COF_CustomerOrderForm']['fields']['quotation_c']['populate_list']['cof_customername_c']='billing_account_name';
    $dictionary['COF_CustomerOrderForm']['fields']['quotation_c']['populate_list']['contactname_c']='billing_contact_name';
    $dictionary['COF_CustomerOrderForm']['fields']['quotation_c']['populate_list']['billingaddress_c']='billing_address_street';
    $dictionary['COF_CustomerOrderForm']['fields']['quotation_c']['populate_list']['billingstate_c']='billing_address_state';
    $dictionary['COF_CustomerOrderForm']['fields']['quotation_c']['populate_list']['billingcountry_c']='billing_address_country';

    ?>

Children