SHARE
TWEET

Untitled

a guest Jun 24th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top