Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Trigger fetchaddress on Account (before insert , before update) {
- set<id> acid = new set<id>();
- for(Account ac: Trigger.new){
- if (ac.id != null)
- acid.add(ac.id);
- }
- Map<id,Address__c> fetch = new Map<id,Address__c>([select id,name,City__c,Country__c,Postal_Code__c,State__c,Billing_Street__c from Address__c where id in : acid]);
- for(Account a : Trigger.new){
- Address__c ad = fetch.get(a.id);
- if(A.id !=null)
- a.Billingstreet = ad.Billing_Street__c;
- a.Billingcity = ad.City__c;
- a.Billingstate = ad.State__c;
- a.BillingPostalcode = ad.Postal_Code__c;
- a.Billingcountry = ad.Country__c;
- }
- }
Add Comment
Please, Sign In to add comment