function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfadm sfadmsfadm sfadm 

Automation process based on count roll-up summary field

I have an automation process based on the returned value from a count roll-up summary field.
For instace I have two statuses.
Primary status
Secondary status
Let's say the user creates two records. 

One record with Primary status and another record with Secondary status.
The count which rollup field will return will be 2, because the number of records is two: One with Primary and one with Secondary.
At a certain point in time the user checks a custom checkbox field.
As soon as the checkbox is checked I need to know how to make the rollup field to start couting only the records with Secondary status.
Istead of having 2 the returned count will have to be reduced the to 1, becuse there is only one record with Secondary status and also because the custom checkbox field is checked.
Another example:
User creates
1. record with Primary status
2. record with Primary status
3. record with Secondary status
4. record with Secondary status
5. record with Secondary status

As soon as the user checks the custom checkbox field the returned count will have to be equal to 3, because there are three records with Secondary status and also because the custom checkbox is checked.
Until the custom checkbox field remains checked only the records with Secondary status must be counted.
Please advise how it can be achieved?
Best Answer chosen by sfadm sfadm
Alex SelwynAlex Selwyn
You can use a formula field in the Rollup Field filter criteria. If the formula field is true count for Roll Up.

Formula Field: IF(Checkbox = true, status='Secondary', OR(status = 'Primary',Status='Secondary))