You need to sign in to do that
Don't have an account?
dindev
how can i pass data one object data to another object
I have two objects obj1 and obj2
having same fields like Name,phone when i enter Name phone values in obj1 after saving that will be shown obj2 as well how can achieve this
having same fields like Name,phone when i enter Name phone values in obj1 after saving that will be shown obj2 as well how can achieve this
You just need to write a trigger that copy object1 in object2.
This scenario can be done by using Triggers
Let Us consider
Object 1 - Account
Object 2 - contact
Write trigger on account object(after insert)
TRIGGER:
Trigger objecttgr on Account(after insert){
List<contact> cons =new List<contact>();
for(Account a :trigger.new){
contact c =new contact();
c.lastname = a.name;
c.phone = a.phone;
// we can match the fileds of both objects, what are required fileds u want before going to insert of contact
c.accountid = a.id;
cons.add(c);
}
insert cons;
}
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
Try this code: I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi