You need to sign in to do that
Don't have an account?
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"/>
</apex:page>
Any help in directing me to the solution for the above requirement is greatly appreciated.
Thank you
Raghu
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;)
Cool_D
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.
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')]; }
}
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
Cool_D