+ Start a Discussion
abhilash reddy 49abhilash reddy 49 

If atleast one of contact checkbox filed is true we have to make corresponding account checkbox filed to true

1.)I have a Checkbox field called "Best Contact" in contact object.
2.)I have a checkBox field called "Contains Best Contact" in account object.
My requirement is if atlest one contact checkbox field (Best Contact)is true then we have to make corresponding Account checkbox filed(Contains Best Contact)to true
Shaijan ThomasShaijan Thomas
Hi Abhilash,

Use process builder to update the Account from contact.
Process builder should be in contact

Thanks
abhilash reddy 49abhilash reddy 49
Hi Thomas,
Thank u for ur reply...
Through Trigger How can I do That?
Narender Singh(Nads)Narender Singh(Nads)

Hi Abhilash,

You can use process Builder or you can write a trigger for your requirement.

The trigger would look something like this:

trigger CheckBox on Contact (after insert, after update) {
    
    account[] acclist=new account[]{};
    
    for(contact c:trigger.new){
        account a= new account();
        if(c.accountid!=NULL && c.Best_Contact__c==true){
            a.Id=c.AccountId;
            a.Contains_Best_Contact__c=true;
            acclist.add(a);
        }
    }
    update acclist;
}

Note: I would suggest you to achieve this using process builder. It quite easy to use the process builder.

Let me know if it helps.
Thanks!