You need to sign in to do that
Don't have an account?
Pankaj Sharma 53
Trigger instead roll up summary
I have a custom object Target__c(parent) and Lead(child) in lookup relationship i want to check no of lead in target then plz help. How should i do this. Leads are visible in related list of target but there is a field in target named as No of Lead i want to update this field by the no of record in related list.
If you head here:
https://github.com/afawcett/declarative-lookup-rollup-summaries
and give the read-me a read, and then install the unmanaged (or managed, depending on your needs) app
Production install link (https://login.salesforce.com/?ec=302&startURL=%2Fpackaging%2FinstallPackage.apexp%3Fp0%3D04tb0000000cBgv)
Sanbox install link (https://test.salesforce.com/?ec=302&startURL=%2Fpackaging%2FinstallPackage.apexp%3Fp0%3D04tb0000000cBgv)
Once you learn how to use this tool, you will never fear lookup relationships (regarding roll ups) again.
If you really just want to write your own trigger to calculate this, just say so and I will talk you through that too (it should be noted, this app has brilliant test coverage AND it GENERATES THE TEST COVERAGE FOR YOUR NEW TRIGGER as well, as generating the trigger!)