+ Start a Discussion

Update check box on parent if child record with specific name found.

Hi All,

I have a requirement where i have to fetch child records with specific name. If found i need to update check box to true on parent object.

Please help me how can i do that.

Thanks In Advance.
Khan AnasKhan Anas (Salesforce Developers) 

Greetings to you!

In order to update checkbox on the parent object using child record, you can use below trigger:
trigger UpdateCheckbox on Contact (after insert, after update) {
    List<Account> acc = new List<Account>();
    List<Account> acc1 = new List<Account>();
    for(Contact c : [SELECT Id, Name, Account.Cb__c FROM Contact WHERE Id IN:Trigger.new]){
        if(c.Name == 'Khan' ){

    for(Account a : acc){
    update acc1;

Parent: Account
Child: Contact
Checkbox field on parent: Cb__c

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks and Regards,
Khan Anas
Bhargavi TunuguntlaBhargavi Tunuguntla
Hi Chubby,

For this you can write a trigger/Process builder on child object on insert/update.But As its good to use standard functionalities it's good to use Process builder.

For now, I have created an process builder on 'Opportunity' if it contains the name 'test' in the name field then the related Account checkbox will be true.

User-added image

Criteria checking if name contains 'test'Update the related Account checkbox
Hi Bhargavi,

Thanks for your suggestion. Process builder works great. But what If I have multiple string values to be checked.
Here I don't want to hard code any value. So Any idea? I tried using Custom Labels but seems Contains operator is not working when we have multiple values to be checked.

Bhargavi TunuguntlaBhargavi Tunuguntla
Hi Chubby,

Sad to say this.Yes, your CONTAINS function is matching the whole value of custom label. You may have to create separate labels.