You need to sign in to do that
Don't have an account?
Azusfdc
I have written both triggers needed to be one would any body make it as one ?
trigger trgset on contact (after insert) { List<Contact> conToUpdate = new List<Contact>() ; for(Account acc : [Select Name,(Select id ,LastName from Contacts where id in: trigger.new ) from Account ] ) { for(Contact con : acc.Contacts) { con.LastName = acc.Name ; conToUpdate.add(con) ; } } if(conTOUpdate.size() > 0) { update conTOUpdate ; } }
Trigger Childtoconupdate on ChildtoContact__c(after insert) { List<ChildtoContact__c> ctlist=new List<ChildtoContact__c>(); for(contact con:[Select lastname,(select id,name from ChildtoContactsrelation__r where id in:trigger.new) from Contact]) { for(ChildtoContact__c ct:con.ChildtoContactsrelation__r) { ct.name=con.LastName; ctlist.add(ct); } } if(ctlist.size()>0) { Update ctlist; } }
doravmon
These two trigger on different object, can't combine...
Azusfdc
here is the relationship contact is parent of ChildtoContact__c