Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. Map<Legitimation__c, List<ChecklistTemplate__c>> ligitimatCheckListTemplate = new Map<Legitimation__c, List<ChecklistTemplate__c>>();
  2.  
  3. for (Legitimation__c eachLegitimation : newLegitimations) {
  4.  
  5. String legalStructure = legalStructAccount.get(eachLegitimation.Account__c).LegalStructure__c;
  6. ligitimatCheckListTemplate.put(eachLegitimation, [SELECT Name FROM ChecklistTemplate__c WHERE Entity__c ='legitimation' AND LegalStrucure__c includes (:legalStructure)]);
  7. }
  8.  
  9.  
  10. for (Legitimation__c eachLegitimationKey : ligitimatCheckListTemplate.keyset()){
  11. for (ChecklistTemplate__c eachChecklistTemplate : ligitimatCheckListTemplate.get(eachLegitimationKey)){
  12. Checklist__c checkList = new Checklist__c(
  13. Name = eachChecklistTemplate.Name,
  14. TemplateId__c = eachChecklistTemplate.Id,
  15. LegitimationId__c = eachLegitimationKey.Id
  16. );
  17. newCheckLists.add(checkList);
  18. }
  19. }
  20.  
  21. insert newCheckLists;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement