9

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?

1 Answer 1

9

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

7
  • 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
    Commented Apr 11, 2014 at 2:04
  • wait, can I use rollup with record count and do a filter on boolean_field = true?
    – NSjonas
    Commented Apr 11, 2014 at 2:12
  • Ah great spot - yes, you can use Filter Criteria in roll up summaries! Go with COUNT() instead. Commented Apr 11, 2014 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
    Commented Apr 11, 2014 at 7:28
  • 3
    user320 strikes again! and @Francis manages to plug his presentation, again ;) Commented Apr 11, 2014 at 10:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .