+ Start a Discussion
hoagieryderhoagieryder 

Auto Select Checkbox through Parent Account

I have a checkbox in Accounts that is called client. I want all child account client  = True when any one of those accounts has client = True.

 

For Instance:

 

Account A (parent account 1)

Account B (parent account 1)

Account C (parent account 1)

Account D(parent account 1)

 

If Client = True in Account A, I want Client to be set to True in Account B,C and D. Is this possible?

SennahSennah

Not sure if I understand you right, but if you have a parent-child relationship and want to display something at the child, you could also use a formula field;

 

 

Account.Your_Field__c

 

This would display "Your_Field__c" from the parent account.

 

hoagieryderhoagieryder

I don't think I understand what your saying either, haha. Let me further explain. Say I have 4 accounts: A, B, C, D.

A is Parent

B,C,D are all A's Children.

 

There is a field (checkbox) that is clicked if a particular Account is a client of ours. If any of these particular accounts are a client I want that box to be checked in all connected accounts. If A is a client, then so is B,C and D.

SennahSennah

Okay, if you exactly want to set the checkbox, you will not get around writing a trigger.

 

Otherwise, if BCD are all direct children of A you could create a formula field on Accounts and check if ParentAccount.YourCheckbox__c is true and when it is true display a certain value or information in the formula field.

hoagieryderhoagieryder

Yea that works great. The only problem is if it is not the parent account, I still want all associated accounts to be true. If B= True, then I want A,C, and D = True. So basically I want child accounts to update the parent as well as other child accounts. Is this possible or do I need to make some type of trigger?

SennahSennah

Then you'll not get around writing a trigger...

SteveBowerSteveBower

And, it's an interesting trigger because it will recurse unless you control that.    Child changes, triggers an update to the parent which changes and triggers an update to all the children, and so on and so on.  The Force.com Cookbook has an example of how to limit recursion.

 

Best, Steve.