Skip to main content
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
3 个回答
  1. 2019年4月30日 16:55
    Hi dindev,

    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

     
0/9000