Pulling Parent Fields via Populate List

Hi all.

I am trying to use the vardef (populate_list) to pull fields in on the subpanel create. I have this working for Contacts by doing something simple such as:

$dictionary['Contact']['fields']['account_name']['populate_list']['description'] = 'description';

However when trying to do the same for a parent field (flex relate), I can't seem to pull it in. Even when using the actual link itself, for example:

$dictionary['Calls']['fields']['calls_leads']['populate_list']['description'] = 'description';

I spotted the article from (https://sugarclub.sugarcrm.com/dev-club/b/dev-blog/posts/introducing-populate_5f00_list-in-parent-fields) however when trying to implement it, nothing seems to be pulling, I've tried the following:

$dictionary["Calls"]["fields"]["parent_name"]['auto_populate'] = true;
$dictionary["Calls"]["fields"]["parent_name"]['parent_populate_list'] = [
	'Leads' => [
		'description' => 'description',
	]
];
$dictionary["Calls"]["fields"]["calls_leads"]['auto_populate'] = true;
$dictionary["Calls"]["fields"]["calls_leads"]['parent_populate_list'] = [
	'Leads' => [
		'description' => 'description',
	]
];
$dictionary["Calls"]["fields"]["calls_leads"]['auto_populate'] = true;
$dictionary["Calls"]["fields"]["calls_leads"]['parent_populate_list'] = [
	'leads' => [
		'description' => 'description',
	]
];

I feel I am missing something super obvious, so if anyone can help I'd really appreciate it!

Thank you,

Daniel

  • Did you try

    $dictionary["Call"]["fields"]["parent_name"]['auto_populate'] = true;
    $dictionary["Call"]["fields"]["parent_name"]['populate_list'] = [
    		'description' => 'description',
    ];
    

    The two issues I see

    1) Use "Call" instead of "Calls"

    2) Use "populate_list" instead of "parent_populate_list"

  • Hi John. Rookie mistake on the first one! Just changed my tests to that but still no luck, the "parent_populate_list" was a new .js file in that article.

    Using the populate_list it still doesn't seem to be working, I've tried this now:

    $dictionary["Call"]["fields"]["calls_leads"]['auto_populate'] = true;
    $dictionary['Call']['fields']['calls_leads']['populate_list']['description'] = 'description';
    
    $dictionary["Call"]["fields"]["parent_name"]['auto_populate'] = true;
    $dictionary["Call"]["fields"]["parent_name"]['populate_list'] = [
    		'description' => 'description',
    ];
    
    $dictionary["Call"]["fields"]["calls_leads"]['auto_populate'] = true;
    $dictionary["Call"]["fields"]["calls_leads"]['populate_list'] = [
    		'description' => 'description',
    ];

  • Hi Daniel

    The implementation I wrote in that article works like a charm in versions 9.x and 10.x. I still didn't try it under version 11.0. What is your current version?

    Did you create custom js controller as per article instructions?

    Mind that, as noted, you should use bean name (Call) instead of module name (Calls).

    John, parent_populate_list is the correct attribute, once my custom implementation on parent field type differs from core implementation. I implemented that way in order to avoid any further conflict.

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Hi Andre.

    I've put your custom JS controller in custom/clients/base/fields/parent/parent.js.

    Then I created a vardef within custom/Extension/modules/Calls/Ext/Vardefs and populated that with 

    $dictionary["Call"]["fields"]["parent_name"]['auto_populate'] = true;
    $dictionary["Call"]["fields"]["parent_name"]['parent_populate_list'] = [
    	'Leads' => [
    		'description' => 'description',
    	]
    ];

    However I'm still not having any luck, this site is 10.0.2 and after a QRR it's not working. Just to confirm I am starting the call creation from the Lead subpanel.

    Thanks for your help!

  • Thank you for clarifications, Daniel.

    Once you are creating Calls from subpanel under a Lead then you need to implement similar code into Leads as well:

    $dictionary["Lead"]["fields"]["calls"].

    The code described in my article accomplishes creating/editing records directly from its module instead of creating a new one from subpanel.

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Hi Andre.

    Thanks for this, do you have a code sample of it working for you via subpanels? The standard populate_list requires the vardef to only be on the "child" not the parent. So wondered if you had a working code snippet I could digest.

    My general workflow is:
    1) Create new lead

    2) Fill in description field

    3) Creating call from the description subpanel on leads

    4) Desired output is expecting Lead description to fill in the Calls Description

    Thank you,

  • I've sorted it no worries! It seems for this example we did need it to go on Leads which wasn't how I had it before but it works!