record.js - linked record - get full attributes 

Hi all,

I extended the ProductCatalog / Product Template with a new integer field (extended  the Vardefs) and I am able to fill this field via the GUI and data are in the MySQL database. 

At the opportunities module the product is linked at each record.

When I now look at the console.log(this.model.attributes); JavaScript Log for one record in the Opportunites record.js, the linked Product is shown, but the new integer field is not shown

Only the "standard" SugarCRM Product fields are shown.

How can I make my field available there?


Many thanks

Sven

  • Hello Sven Waldinger

    Have you tried retrieving that same bean in the JS? Then you can manipulate the bean, save and refresh.

    oppBean = app.data.createBean('Opportunities', {id: oppID});

    oppBean.fetch({     success: function(){ /* do stuff */},     error: function(){ /* do stuff */} });

    Not sure if this is the proper way but has worked for me.

    Regards, 

    Angel M.

  • Hi Angel Martinez,

    thank you for your reply.

    I tried this function now, but I still don't receive the data of my new custom field - I only get the standard fields of the Product.

    Best Regards

    Sven

  • Hello Sven Waldinger

    Try to add the following to the record.php.

    By adding the related_fields parameter to any field in the record view, you will be able to see those fields in the console, as they are now part of the model. It could be added to any field, I've done it through the status field.

     1 => array (
                    'name' => 'status',
                    'label' => 'LBL_STATUS',
                    'related_fields' => 
                    array (
                      0 => 'field_1',
                      1 => 'field_2',
                      3 => 'field_3',
                      4 => 'field_4',
                    ),
                  ),
    Hope this helps.
    Regards, 
    Angel M.
  • Hi Angel Martinez,

    I tried this, but seemed to have no effect.

    But I found another solution which works for me:

    I added to the Opportunity Vardef where I have the "type = relate" field  to the Product Template some additional info:

    $dictionary['Opportunity']['fields']['my_product_template_name']['populate_list']['mynewfield'] = 'mynewfield';

    This also auto fills the field when changing the Product on the Opportunity