2

I am writing some business rules which expect data to be captured properly in many fields while record creation. Most of the fields for most of the records are blank and not captured by user. We need to put some validation logic like make important fields required etc. We need a way to find fields on objects which are null for most of the records. How can we do a SQL COUNT(*) kind of thing to find null count for columns across sObjects.

0

1 Answer 1

4

How can we do a SQL COUNT(*) kind of thing to find null count for columns across sObjects.

You could probably use the SOQL Aggregate Functions. In particular COUNT() in combination with GROUP BY.

E.g.

SELECT Count(Id)
FROM Account
WHERE FieldThatMightBeNull__c == null

You must log in to answer this question.

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