You need to sign in to do that
Don't have an account?
alok7049
How to write trigger for join Object.
prob is :Add a trigger that when a join object is inserted, the trigger will copy the billing street address from the related Account to the other streets address on the related Contact.
can any one please help me out in doing this.
Try This with changing with your field names and object name
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.
All Answers
Hi Alok,
Please find attached the code for copying the related account billing address into other street address related fields in contact object as contact is getting created:-
trigger copystreetaddress on Contact (before insert ,before update)
{
if(trigger.isbefore)
{
if(trigger.isinsert)
{
Contact con=trigger.new[0];
if(con.accountid!=null)
{
account a1=[select BillingStreet from account where id=:con.accountid];
if(a1.BillingStreet!=null)
{
con.OtherStreet =a1.BillingStreet;
}
}
}
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
there is a junction object between Account and Contact.And after inserting a joint object record the related account billing street should be copied to related contact other street.
do reply for this requirement.
Try This with changing with your field names and object name
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.