0

I have an automation process based on the returned value from a count roll-up summary field.

For instace I have two statuses.

  1. Primary status
  2. 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?

1

You need two roll-up summary fields: Count_of_All_Status__c and Count_of_Secondary_Status__c. Both fields should be hidden (not shown on the page layout).

Then you need to cover them with a formula field to determine which is shown, based on the checkbox field:

IF(My_Checkbox_Field__c, Count_of_Secondary_Status__c, Count_of_All_Status__c)

You can't change the definitions of the rollups themselves based upon the checkbox, but you can manipulate how the data is presented.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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