Updating Latest Child Record on Parent Layout in Salesforce Lightning
Updating latest Child Record on Parent Layout in Salesforce Lightning

Updating Latest Child Record on Parent Layout in Salesforce Lightning

09/10/2018 by Ashley Leifer
How to update the latest child record on a parent layout in Salesforce Lightning Record Pages.

Recently I was requested to come up with a solution so end users could easily update a critical child object record right on the Contact’s Lightning Record Page. Note this isn’t possible in Classic, only Lightning. How to achieve this? With some digging and creativity. Here’s how I accomplished this.

The goal of this request was to provide means for efficient data entry for end users who need to spend most of their time on the Contact Lightning Record Page. They want to prevent as much ‘jumping around the platform’ for inputting data as possible. This is where a key child object comes into play, we’ll call it ‘Application object’,  in which they needed to be able to update the most recent of these ‘Application’ records right on the contact layout.

In order to accomplish this, we needed to get creative with actions, Lightning Record pages, and the use of one of my favorite tools, DLRS (Declarative Lookup Rollup Summary).  Honestly without DLRS, this would require coding and a lot more time to create.  

Step 1: Create a lookup field on the Contact object referencing the ‘Application’ object.  That’s right, going around in circles, but, we needed this in order to create the action that could then be added to the Contact Lightning Record Page.

Step 2: Populating the lookup field with the most recent ‘Application’ object record.  This is where DLRS comes in, if we couldn’t achieve this with DLRS we stop at step 1 and call it a day or start talking to developers. Here are the parameters on the DLRS record to build this:

  • Parent Object is the Contact object
  • Child Object is the “Application’ object
  • Relationship Field = lookup field on the ‘Application’ object to the Contact object
  • Field to Aggregate = Id
  • Aggregate Operation = Last
  • Aggregate Result Field = Lookup field created in ‘Step 1’
  • Calculation Mode = Realtime.

That’s it! I’d suggest making the field in Step 1 visible on the page layout to validate the rollup works.

Step 3: Create an Action on the Child Object. In Lightning go to the Object Manager and select the ‘Application’ object, then click on the menu option ‘Buttons, Links, and Actions’. From there, click on the ‘New Action’ button and enter the information as follows:

  • Action Type = Update a Record
  • Label = name for the action, in this case, we’ll call it ‘Update Application’

Then in the action layout add all the fields needed for updating the record, typically best practice is to not include more than 20 fields otherwise Salesforce states this can ‘severely impact user efficiency’.

Step 4: Add the component to the Contact Lightning Record Page.  From the Object Manager, select Contact, then in the menu options, select the Lightning Record Pages option.  From there select edit on the version you want to use. Drag the “Related Record” component to the page editor and select the name of the Lookup field you created in Step 1. Then select the ‘Update Action’ name you created in Step 3. Save, Activate, and Test.

Following all these steps, you should now be able to update the most recently created ‘Application’ record directly on the Contact layout.


Do you have any cool workarounds or tricks for improving end-user ‘less clicks’ solution in Lightning?  Please feel free to comment directly at me on Twitter @LeiferAshley or in the Success Community.