Introducing populate_list in Flex Relate (parent) fields
André Lopes 11 Sep 2020
Here's a guest blog post from experienced Sugar Developer and active DevClub member André Lopes.
The Flex Relate field type (aka parent field) is pretty useful as everybody knows, but it has an important limitation: It doesn't support the out of the box the populate_list vardefs attribute. Even on version 10.0.1 that feature is missing as per some comments in methods format and setValue inside its JS controller. I just got the following requirement: The Signer under a Signature Request is related to a parent record using the flex relate field and, when selected, it must auto populate the respective e-mail address from that parent record.
In this scenario Signer is in a GRID under Signature Request, just like RLI under Opportunities. Signer has parent, name, email address and some other fields. On selecting a parent_type and parent_name the respective primary e-mail address must be copied to Signer bean.
So how could I address such a requirement?
Step 1: Create a custom parent field controller (custom/clients/base/fields/parent/parent.js)
Step 2: Create a vardefs extension
Step 3: Go to Admin -> Repair and run Quick Repair and Rebuild.
That implementation is quite useful for some other requests like:
Copy phone number from some specific parent records to Calls record
Copy address street from some specific parent records to Meetings record
Additionally it doesn't affect other Flex Relate (parent) fields that do not contain the parent_populate_list vardefs attribute.
To full access to Code of Step 1 and 2 just send us a message email@example.com
Our Contributor André Lopes