Activity Forums Salesforce® Discussions How to connect a trigger from more than two sobject in salesforce?


    August 30, 2016 at 8:45 am

    Hi Mohit,

    Yes, We can connect two object which has some sort of relationship between them like in account and contact.

    Here is a sample code, which is on account object. In this trigger when an account is inserted or updated, then its related contact has same phone number in its record.

    trigger CopyAccPhoneToConPhone on Account (after insert, after update)
    list<contact> conlist = new list<contact>();
    for (contact a : [select id, phone, Contact.AccountId, from contact where Contact.AccountId IN:] )
    if(a.accountid != null)
    { =;
    update conlist;

    Hope this helps you.


Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos