You need to sign in to do that
Don't have an account?

count records on lookup
Hi All,
Since rollup summary(count) is available only for master detail how do i get this count of child objects for a lookup relationship.
Trigger is a solution but how would that update existing records?
Is it possible to update existing records with trigger.Please help with sample code if this is possible
Please advise.
I need to get the count for a report
Since rollup summary(count) is available only for master detail how do i get this count of child objects for a lookup relationship.
Trigger is a solution but how would that update existing records?
Is it possible to update existing records with trigger.Please help with sample code if this is possible
Please advise.
I need to get the count for a report
All Answers
http://http://blog.jeffdouglas.com/2009/07/30/roll-up-summary-fields-with-lookup-relationships-part-1/
If you need for more than one object would recommend to try the excellent tool from Andrew
http://andyinthecloud.com/2013/07/07/new-tool-declarative-rollups-for-lookups/
or you can try this
https://github.com/abhinavguptas/Salesforce-Lookup-Rollup-Summaries
See this threads answer you will get some idea.
http://stackoverflow.com/questions/12063240/soql-aggregate-query-count-number-of-rows-returned.
if you want code snippet explain us more about your requirement
https://developer.salesforce.com/page/Declarative_Rollup_Summary_Tool_for_Force.com_Lookup_Relationships
it is also good solution for admin.