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

Re-Render related list on Master record change - need Ideas

Hello Community, 


I have a requirement where I have to add checkboxes to a related list and when user changes value on master record, I have to change all the checked records from related list (change in value in one of the fields from related list). 


Is there a way I could do the above or am I just dreaming ? And btw, I am a newbie in Visualforce (I am sure you could figure out from the request). I really appreciate if you could throw some ideas  on how I can handle this requirement(attached image). All I did so far is the following lines of code 



<apex:page standardController="Projects__c" >

<apex:detail subject="{!Projects__c.Id}" relatedList="false" title="false"/>

<apex:relatedList list="Leads__r"/>


 Any help in directing me to the solution for the above requirement is greatly appreciated.


Thank you





Message Edited by Raghu_dev on 12-06-2009 08:00 PM

If you were to have a button to udpate the related records, then this could have been possible through the standard page itself.

but if you want this to happen automaitcally on the parent record's field update, then you have to use an ActionFunction on the inputField which is being edited on the parent record, and then pass all the selected child records to your controller.

The selected records can be fetched by using a wrapper class. Once you have the selected records, you can do the DML;)



Thanks for the response. Wondering how a button could help as I have to check multiple lead records from the related list using checkboxes. Wrapper class solution is what I just started. As I said earlier, I am totally new to visualforce and struggling with gathering code pieces together. Here is what I have done so far, and any help or guidance is greatly appreciated.



<apex:page standardController="Projects__c" extensions="projectStatusChangeControllerExtension">
<apex:detail subject="{!Projects__c.Id}" relatedList="false" title="false"/>
<apex:pageBlock title="Leads">
<apex:dataTable value="{!Projects__c.leads__r}" var="lead" cellPadding="4" border="1">
<apex:column > {!lead.FirstName} </apex:column>
<apex:column > {!lead.LastName} </apex:column>

 Controller code



public with sharing class projectStatusChangeControllerExtension {
private final Projects__c prjct;
public projectStatusChangeControllerExtension (ApexPages.Standardcontroller stdController){
this.prjct = (Projects__c)stdController.getRecord();
public Projects__c getProject() {
return [select id, name,
(select id, firstname, lastname
from Leads__r limit 5)from Projects__c where id =:System.currentPageReference().getParameters().get('id')]; }





Message Edited by Raghu_dev on 12-07-2009 12:27 PM

Well, with the button, you can actually get the record ID's of all the checked records easily using the {!getRecordIds} function.

Once you have the ID's, you can process them the way you want to;)

Speaking about the Wrapper Class, refer to the below blog and that's what you need to do-

Wrapper Class