Guest User

Untitled

a guest
Feb 18th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. trigger ProcdureTrigger on Test1105__Procedure__c (before update) {
  2. public map<Test1105__Procedure__c,List<Test1105__Procedure_product__c>> accountContactMap = new map<Test1105__Procedure__c,List<Test1105__Procedure_product__c>>();
  3.  
  4. 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];
  5.  
  6. for(Test1105__Procedure__c acc : lstAccount)
  7. {
  8. accountContactMap.put(acc, acc.Test1105__Procedure_products__r);
  9. }
  10.  
  11. for(Test1105__Procedure__c pro :accountContactMap.Values()){
  12. if(pro.Test1105__Status__c =='Completed' && pro.Test1105__Type_of_Event__c =='Rythmia Case'){
  13. if(accountContactMap.get(Test1105__Procedure_products__r).Test1105__Steerable__c == NULL && pro.Test1105__CS__c == NULL){
  14. pro.addError('Need Related Records');
  15. }
  16.  
  17. }
  18. }
  19.  
  20. System.debug(accountContactMap);
  21.  
  22. }
Add Comment
Please, Sign In to add comment