Ask Search:
Brendan YoungBrendan Young 

Custom field to count # of activities?

Is there a way to create a custom field which counts the number of activities associated with an opportunity?
Best Answer chosen by Moderator (salesforce.com) 
Javier GonzalezJavier Gonzalez
Unfortunately no. You'll need Apex if you want to go the field route.

However, if you do not need it to be displayed on the page, you can create a custom button or link that calls an Activities with Opportunities report and passes the activity ID in the URL, thus filtering the report for the given Opportunity record. 



All Answers

Javier GonzalezJavier Gonzalez
Unfortunately no. You'll need Apex if you want to go the field route.

However, if you do not need it to be displayed on the page, you can create a custom button or link that calls an Activities with Opportunities report and passes the activity ID in the URL, thus filtering the report for the given Opportunity record. 



This was selected as the best answer
Brendan YoungBrendan Young
Thanks Javier. By field route, do you mean as opposed to something like custom objects? Do you think there would be something on the app exchange that could help us with this? It's weird that something that's so easy to do in excel would be so tough to do in SF, but I guess that is because this count would require constant updating across our Salesforce org, therefore making everything slow?
Steve MolisSteve Molis
Javier GonzalezJavier Gonzalez
By field route I mean displaying the total in a field, mimicking a summary roll-up field.

I don;t think there's anything like this on the AppEx. Check out Rollup Helper. Not sure it will do it.
https://appexchange.salesforce.com/listingDetail?listingId=a0N30000009i3UpEAI

I
 think the biggest issue with this as a native piece of functionality is that the task/event object has multiple look-up fields and not really any master detail relationships. I'd love to know how SFDC handles this in the background.
Brendan ConroyBrendan Conroy
I couldn't find anything else either. The closest thing was an old idea which sort of relates (which I just promoted because i think that it is a genuinely good idea) 

https://success.salesforce.com/ideaView?id=08730000000BrZxAAK

Cheers,

Brendan
Steve MolisSteve Molis
I just tested a Roll-Up Helper "Count of Activities" field on the Opportunity object and it worked.
Dominic SebastianDominic Sebastian
How do we use the roll up helper to count the activities ?.