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
srikanth challasrikanth challa 

How to calculate total count of the field with a particular status in formula field

Can we calculate total number of records with Warranty Status = 'INACTIVE' in the formula field. If NO could you guys please suggest me a best way to do it?
Best Answer chosen by srikanth challa
Mikhail MuzoMikhail Muzo
The Roll-up Summary is only possible when there is a master detail relationship...
however, I think you can create a workflow to update the field of an object when a new record is saved or modifed to be Warranty Status Incavtive
Another good choice is to do an apex trigger and calculate the field value every time a change is made to the record, however you need to have a parent object,

If you dont have a parent object... the RollUp summary field would be your best choice. Create a Parent object and create a master detail relationship from the record you have (the one with the Warranry Status field) to the new custom object and in the parent create a rll up summary with the criteria Vidya said on the previous answer

All Answers

Vidya DVidya D
You can create Roll-up Summary on parent object with specific criteria Warranty Status = 'INACTIVE'
Mikhail MuzoMikhail Muzo
The Roll-up Summary is only possible when there is a master detail relationship...
however, I think you can create a workflow to update the field of an object when a new record is saved or modifed to be Warranty Status Incavtive
Another good choice is to do an apex trigger and calculate the field value every time a change is made to the record, however you need to have a parent object,

If you dont have a parent object... the RollUp summary field would be your best choice. Create a Parent object and create a master detail relationship from the record you have (the one with the Warranry Status field) to the new custom object and in the parent create a rll up summary with the criteria Vidya said on the previous answer
This was selected as the best answer