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

Need some help for activity count trigger
I would like to tweak the apex class in the link below to only count activities with a type of "Call". How can I do that?
Link: http://www.radialweb.com/2010/08/summarizing_salesforce_fields_with_triggers/#comments
Referencing the article...
Look for the line that says:
...and change it to:
That will filter the tasks so that it only includes those that are calls, and ignores the rest.
To make it work, you'll also need to modify the test method so that it matches the new criteria.
Look for the following code in testCountTask:
and change it to:
Note we're updating the test code so that its inserting a Call task...otherwise the unit test would fail since the non-Call task would not get counted
Hope that helps
--Kevin
All Answers
Referencing the article...
Look for the line that says:
...and change it to:
That will filter the tasks so that it only includes those that are calls, and ignores the rest.
To make it work, you'll also need to modify the test method so that it matches the new criteria.
Look for the following code in testCountTask:
and change it to:
Note we're updating the test code so that its inserting a Call task...otherwise the unit test would fail since the non-Call task would not get counted
Hope that helps
--Kevin
Excellent! Thank you very much!
I have a trigger that already exists in production but has 0% code coverage. Can you tell me how I can build an apex class to create a higher code coverage? Thanks.
Nevermind, I figured it out. Thanks.
Kevin,
Can I use the same class/trigger to count the number of campaigns on a lead/contact/opportunity? I know my way around some code but I am not a developer so is the change "easy"? If so, how would I make this change? Thanks.
-Aaron