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
Sabah FarhanaSabah Farhana 

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
Best Answer chosen by Sabah Farhana
Avidev9Avidev9
You can give a try to the rollup helper app from the appexchange. Its realy to use and free ! https://appexchange.salesforce.com/listingDetail?listingId=a0N30000009i3UpEAI

All Answers

Avidev9Avidev9
You can give a try to the rollup helper app from the appexchange. Its realy to use and free ! https://appexchange.salesforce.com/listingDetail?listingId=a0N30000009i3UpEAI
This was selected as the best answer
RishavRishav
if you have requirement for only one object ,you can prefer jeff solution as well
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


Vidhyasagaran MuralidharanVidhyasagaran Muralidharan
We can use aggregate result for your requirement
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
RishavRishav
From salesforce there is one declarative solution you can try that also
https://developer.salesforce.com/page/Declarative_Rollup_Summary_Tool_for_Force.com_Lookup_Relationships


it is also good solution for admin.
Sabah FarhanaSabah Farhana
Thanks Guys! Roll up helper is perfect for me..But thanks for the code solutions very very useful