Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trigger ProcdureTrigger on Test1105__Procedure__c (before update) {
- public map<Test1105__Procedure__c,List<Test1105__Procedure_product__c>> accountContactMap = new map<Test1105__Procedure__c,List<Test1105__Procedure_product__c>>();
- List<Test1105__Procedure__c> lstAccount = [SELECT Id, name, (SELECT Test1105__Procedure_Name__c,Test1105__Steerable__c,Test1105__CS__c FROM Test1105__Procedure_products__r) FROM Test1105__Procedure__c];
- for(Test1105__Procedure__c acc : lstAccount)
- {
- accountContactMap.put(acc, acc.Test1105__Procedure_products__r);
- }
- for(Test1105__Procedure__c pro :accountContactMap.Values()){
- if(pro.Test1105__Status__c =='Completed' && pro.Test1105__Type_of_Event__c =='Rythmia Case'){
- if(accountContactMap.get(Test1105__Procedure_products__r).Test1105__Steerable__c == NULL && pro.Test1105__CS__c == NULL){
- pro.addError('Need Related Records');
- }
- }
- }
- System.debug(accountContactMap);
- }
Add Comment
Please, Sign In to add comment