How to add/set custom fields in QLI on quotes in Sugar 7.9.2?

Hi All,
On Quotes when adding QLI, we need to add a custom field total_units_c that will be fetched from ProductCataloge and can be editable by user.

Please note that, total_units_c is in Products (QLI) and same name in ProductCataloge as well.

I am able to add the custom field but its value is not fetched from Productcatalog.

I followed the article http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.9/Architecture/Quotes/

But it did not help for custom fields.
Can anybody know where we need to add the custom field that it will fetch from ProductCatalog.

Any help is really appreciated.

Regards,

Usman

Parents
  • To populate the value from the catalog, add the field to the populate_list in your vardef extensions:

    custom/Extension/modules/Products/Ext/Vardefs/your_extension_file.php (path corrected per Usman Saeed, Thank you for catching that!)

     

    $dictionary['Product']['fields']['product_template_name']['populate_list']['total_units_c'] = 'total_units_c';

     

    HTH,

    FrancescaS

Reply
  • To populate the value from the catalog, add the field to the populate_list in your vardef extensions:

    custom/Extension/modules/Products/Ext/Vardefs/your_extension_file.php (path corrected per Usman Saeed, Thank you for catching that!)

     

    $dictionary['Product']['fields']['product_template_name']['populate_list']['total_units_c'] = 'total_units_c';

     

    HTH,

    FrancescaS

Children
  • Hi Francesca Shiekh. Thank you for the guidance and help. It worked.

    1 small change, I added file in extension dir, at the path custom/Extension/modules/Products/Ext/Vardefs/

    Regards,

    Usman

  • I tried to do a similar thing by defining the following populate_list:

    $dictionary['Product']['fields']['product_template_name']['populate_list']['partner_type_c'] = 'partner_subsidiary_c';
    $dictionary['Product']['fields']['product_template_name']['populate_list']['emis_servia41deements_ida'] = 'emis_servi902aeements_ida';
    $dictionary['Product']['fields']['product_template_name']['populate_list']['emis_servicelevelagreements_producttemplates_1_name'] = 'emis_servicelevelagreements_products_1_name';

    This is defined in the `custom/Extension/modules/Products/Ext/Vardefs/sugarfield_product_template_name.php` file .

    The problem is I then get these errors in the browser console:

    ERROR[2017-12-28 17:22:15]: Fail to populate the related attributes: attempt to access undefined key - ProductTemplates::partner_type_c
    ERROR[2017-12-28 17:22:15]: Fail to populate the related attributes: attempt to access undefined key - ProductTemplates::emis_servia41deements_ida
    ERROR[2017-12-28 17:22:15]: Fail to populate the related attributes: attempt to access undefined key - ProductTemplates::emis_servicelevelagreements_producttemplates_1_name

    After some debugging I found that this seems to be caused by the field type (`quote-data-relate`) used for the `product_template_name` field in the `custom/modules/Products/clients/base/views/quote-data-group-list/quote-data-group-list.php` file.

    If you take a look at the `modules/Products/clients/base/fields/quote-data-relate/quote-data-relate.js` file, the `_getPopulateMetadata` function has been overridden to return the metadata for the Products module. This causes the error in the `initialize` function in the `clients/base/fields/relate/relate.js` file. I commented out the overridden function and it works - so no idea why is was overridden.

    Did anyone else have this problem?