Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.46 KB | None | 0 0
  1. trigger InsuranceCheck on Treatment__c (after insert) {
  2.  
  3. integer count;
  4. for(Treatment__c t:trigger.new){
  5.     count=[select count() from Physician_Insurance__c where Insurance__r.name=:t.insurance__r.name];
  6.    
  7.     if(count==0)
  8.     {   Physician_Insurance__c pi=new Physician_Insurance__c();
  9.         //pi.name=t.Insurance__r.name;
  10.         pi.Physician__c=t.Patient__r.Primary_Referring_Physician__c;
  11.         pi.Insurance__c=t.insurance__c;
  12.         //pi.PI_ExtID__c=
  13.         insert pi;
  14.     }
  15.        
  16.     }
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement