Guest User

Untitled

a guest
Dec 11th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. public with sharing class myClass {
  2. private final Parent__c SiteP;
  3. public List<Child__c> childList {get; set;}
  4. public List<GrandChild__c> grandchildList {get; set;}
  5. public myClass (ApexPages.StandardController stdController)
  6. { SiteP = [SELECT Id, Name,Status__c FROM Parent__c
  7. WHERE Id =
  8. :ApexPages.currentPage().getParameters().get('id')];
  9. }
  10.  
  11. //Public lists here for Child and Grandchild records//
  12.  
  13. public PageReference saveAll() {
  14. update childlist;
  15. List<GrandChild__c> children = new List<GrandChildren__c>();
  16. for (Child__c c : childList) {
  17. grandchildlist.addAll(c.GrandChild__r);
  18. }
  19. update grandchildlist;
  20. update SiteP;
  21. return apexpages.currentpage();
  22.  
  23. <apex:page standardController="Parent__c" extensions="myClass">
  24. <apex:form >
  25. <apex:commandButton value="Save" action="{!saveAll}"/>
  26.  
  27. //Parent__c section here used from standard controller//
  28.  
  29. //Child__c code section here used from extension//
  30.  
  31. //GrandChild__c code section here used from extension//
  32.  
  33. </apex:form>
  34. </apex:page>
Add Comment
Please, Sign In to add comment