Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Is it possible to use a roll up or formula field to count the number of "true" or "false" values on a boolean field of a detail record?

Example:

Account <-Master-----Detail-> My_Object__c

My_Object__c has a boolean (checkbox) field called My_Boolean__c

I want to create a field on Account Object that will tell me how many of the child objects have My_Boolean__c set to false.

Is this possible without creating a trigger or workflow?

share|improve this question

1 Answer 1

As you spotted, this can be done declaratively in one fell swoop!

  1. On the Master, create a Roll-up Summary called CountMyBoolean__c with COUNT

  2. Under Filter Criteria choose 'records meeting certain criteria' and MyBoolean__c equals True

share|improve this answer
    
yea, I considered this. I just wanted to check if there was a way to do skipping step one. Guess one extra field won't hurt... –  NSjonas Apr 11 at 2:04
    
wait, can I use rollup with record count and do a filter on boolean_field = true? –  NSjonas Apr 11 at 2:12
    
Ah great spot - yes, you can use Filter Criteria in roll up summaries! Go with COUNT() instead. –  user320 Apr 11 at 2:16
1  
Remember the Apex Ten commandments. Thou shalt find a happy balance between clicks and code ( m.youtube.com/?#/watch?v=D7mqMYliy3A). –  Francis Apr 11 at 7:28
2  
user320 strikes again! and @Francis manages to plug his presentation, again ;) –  Simon Lawrence Apr 11 at 10:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.