function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ranjith DevRanjith Dev 

Disply child object records through parent object id using List Button from lightning.

I have a list button and that is added in the related list of parent object(Using Wrench Symbol). Now Based on parent record id, i want to print the all related child records. Selected the ParentId through merge field section then the id passed as Null in the Url. Onload is it possible to get the id of parent object?


Thank you
AbhishekAbhishek (Salesforce Developers) 
Hi,

I need to provide some background to get to the answer properly.

Simply: Triggers are not meant to control the UI elements. 

The purpose of triggers is to automate the process upon the events like insert, update, delete, and undelete. they only handle the data in your system. No other business.
It can also be said, "There is no other way you can use trigger logic without making a DML." 
That is why the syntax has a mandatory aspect of BEFORE_EVENT and AFTER_EVENT.

Things TRIGGERS can do upon those DML statements, some:
It can create related data or any data for that matters,
It can Query the database and update data, not to mention the deletes, etc,
It is synchronous
The list goes on...

Things TRIGGERS cannot do, some:
Redirect the user to a different page based on the value
Callout during the save/ delete, so developers use the workaround
Show and Hide certain data elements on the record (Your case here)
Salesforce has given other solutions for other challenges.
If you want to show all the child records on parents, bring them all on the page layout. if you want to show more records, click on the "show more" link below on the related list.

For your reference, you can check the below blog too,

https://salesforce.stackexchange.com/questions/195247/i-want-to-display-child-object-records-when-click-on-parent-object-record-name-i