Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Map<Legitimation__c, List<ChecklistTemplate__c>> ligitimatCheckListTemplate = new Map<Legitimation__c, List<ChecklistTemplate__c>>();
- for (Legitimation__c eachLegitimation : newLegitimations) {
- String legalStructure = legalStructAccount.get(eachLegitimation.Account__c).LegalStructure__c;
- ligitimatCheckListTemplate.put(eachLegitimation, [SELECT Name FROM ChecklistTemplate__c WHERE Entity__c ='legitimation' AND LegalStrucure__c includes (:legalStructure)]);
- }
- for (Legitimation__c eachLegitimationKey : ligitimatCheckListTemplate.keyset()){
- for (ChecklistTemplate__c eachChecklistTemplate : ligitimatCheckListTemplate.get(eachLegitimationKey)){
- Checklist__c checkList = new Checklist__c(
- Name = eachChecklistTemplate.Name,
- TemplateId__c = eachChecklistTemplate.Id,
- LegitimationId__c = eachLegitimationKey.Id
- );
- newCheckLists.add(checkList);
- }
- }
- insert newCheckLists;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement