You need to sign in to do that
Don't have an account?
munna123
how to update phone field of account obj from contact obj phone field using trigger
hi all...here we need to write a trigger. we need to create a contact on contact object for a particular account. when we give the value in phone field of contact, the phone field of parent account of this contact should get updated with the phone field value given in contact object.
am a beginner so not understanding.
here is my coding
trigger tgr_fieldupdate on Contact (after update) {
list<contact> ls= [select id,phone from contact];
contact con= trigger.new[0];
account acc = new account();
for(contact c:ls){
c.phone= acc.phone;
update acc;
}
}
am a beginner so not understanding.
here is my coding
trigger tgr_fieldupdate on Contact (after update) {
list<contact> ls= [select id,phone from contact];
contact con= trigger.new[0];
account acc = new account();
for(contact c:ls){
c.phone= acc.phone;
update acc;
}
}
This is the simple trigger for your requirement. Although it is not following any Best Practise but still works fine.
Please close the thread marking this answer as Best Answer if it really helped. Closing the thread help others finding the correct answer.
Regards,
Swayam Arora
Please close the thread marking this answer as Best Answer if it really helped. Closing the thread help others finding the correct answer.