Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trigger InsuranceCheck on Treatment__c (after insert) {
- integer count;
- for(Treatment__c t:trigger.new){
- count=[select count() from Physician_Insurance__c where Insurance__r.name=:t.insurance__r.name];
- if(count==0)
- { Physician_Insurance__c pi=new Physician_Insurance__c();
- //pi.name=t.Insurance__r.name;
- pi.Physician__c=t.Patient__r.Primary_Referring_Physician__c;
- pi.Insurance__c=t.insurance__c;
- //pi.PI_ExtID__c=
- insert pi;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement