AnsweredAssumed Answered

Getting the count of a related field with a condition

Question asked by raykennedy on Sep 18, 2015
Latest reply on Sep 18, 2015 by raykennedy

Looking to get a count of specific field based on conditions.

 

Simple example
Table 1 = Contacts

Table 2 = Phone Numbers (related table)

 

Table of Phone numbers has a field of phoneType ("Office","Cell","Fax" etc)

 

I would like to count the number of related records with a condition that says if ( phoneType="Cell") or something like that and than take action based on what the count is. I don't need the count of all related records for that table, just the ones that match the condition.

 

I know I can get the Count of related records using the Count() script and/or do a summary field. This will all be done on a script trigger of on modify on the drop down when the user changes the phoneType in a portal from the layout of the Contacts.

 

My main question or obstacle is I am not sure how to incorporate the condition in the count, I only know how to count all related records.


Any thoughts?

Outcomes