You need to sign in to do that
Don't have an account?
VijayNi
trigger to update Lastname on contact object whenever Lastname is updated on account object
Hi All,
can you help me on writting the trigger whenever name is updated on account contact name also should be updated.
1. I am updating using the related filed id condition
trigger accountname on Account (before insert) {
list<contact> contacts = new list<contact>();
set<id> accountd = new set<id>
accountid = [select idrom contact where id in :trigger.new]
lis<contacts> con = new list[slect id,name from contacts where id in :accountd]
for(account acc : trigger.new){
if(acc.id ==accountd.id)
{
con.LastName = acc.Lastname;
contacts.add(con);
}
}update contacts;
}
can you help me on writting the trigger whenever name is updated on account contact name also should be updated.
1. I am updating using the related filed id condition
trigger accountname on Account (before insert) {
list<contact> contacts = new list<contact>();
set<id> accountd = new set<id>
accountid = [select idrom contact where id in :trigger.new]
lis<contacts> con = new list[slect id,name from contacts where id in :accountd]
for(account acc : trigger.new){
if(acc.id ==accountd.id)
{
con.LastName = acc.Lastname;
contacts.add(con);
}
}update contacts;
}
I was wondering if you were able to take a look at the solution I posted on
https://developer.salesforce.com/forums/ForumsMain?id=9062I000000IVTDQA4 which seems to be the same as this question.
If you are looking for something else, can you elaborate so I can suggest better? If this information helps, please mark the answer as best.Thank you
try this following trigger.
I hope it will work of your requirment.
let me know if it's helps you and mark the best of this so that it can help to others.
Thank You