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
VivoVivo 

Is there a way to manipulate related list from a visualforce page?

Hi,

 

I am looking for a way to access and manipulate the related list of an object directly from a visualforce page. I want to be able to access each object as if it was in an array or a list, and remove or add them. i.e. Related List[1] = Feature X and so on. 

 

For example, let's say I have an object Car with a many-to-many relationship to object Feature.

 

Car A -> Has features : Leather Seat, Xeon Lights, Premium Package.

 

On Car A's page, I would like to pull up a shuttle box that lets me add/remove features on the fly.

 

Can anyone point me in the right direction?

 

Thanks!

 

 

 

 

APathakAPathak
This can be achieved using standard out of the box functionality.
For many to many relationship a custom object "Car Features" will be created which will have 2 master-detail relationship fields with Car and Feature objects. The related list of Car Features object will be displayed under Car object from where add,edit,del functionality are already there.
VivoVivo
Yes, I have already set up the Junction Object to relate the Car and Features together. I know the add/del/edit buttons exist on the display layout, but I am looking for that same functionality as apex/visualforce commands to be used in the background. Basically I have a custom layout for the Car object, and I would like to be able to directly add/remove features from the related list via commands in the controller. Any thoughts on this?

Thanks again for your help