You need to sign in to do that
Don't have an account?
narensfdc
Trigger on account for after update event
Hi,
I have a scenario with trigger.......... like when i am updating billing address fields in account the same should be
reflected in contact object fields.
I used after trigger event but i am getting an error .
help me out in this senario.....
thanks
What error are you getting?
Please post the code and the error for better understanding of the error
this is the code,its working while i am inserting a new record
the requirement is when i am updating account fields, that should get reflected the same in contact as well
---------------------------------------------------------------------------------
the requirement is when i am updating account fields, that should get reflected the same in contact as well
---------------------------------------------------------------------------------
trigger insertcononacctrg on Account (after insert) {
account acc = trigger.new[0];
contact con = new contact();
con.lastname = acc.name;
con.mobilephone = acc.phone;
con.accountid = acc.id;
insert con;
}
what error are you getting?
i worked on that trigger ..... this trigger is firing for update operation.....
trigger insertcononacctrg1 on Account (after update) {
account a=trigger.new[0];
list<contact> conlst;
conlst=[select id,name from contact where AccountId=:a.Id limit 10];
if(conlst.size()>0){
for(contact c: conlst){
c.lastname=a.name;
c.mobilephone = a.phone;
c.accountid = a.id;
update c;
}
}
}
thanks
try this.