0

There are 2 parts to this:

Rather than create a report (that I have already) I want users to find out the following

  1. How many 'events' have been created to every campaign? (SUM)

  2. How many of them were marked 'completed'? (SUM of all events marked as 'completed')

I want it to show on the Campaign Statistics section (as below)

Field for the 'completed event?' is a picklist custom field (completed_event__c) with 3 options:

  • No reply
  • Pending
  • Completed

Tried to add the following Formula to a custom formula field on campaign object but it wont accept it:

Activity.num_of_Activities__c:SUM

enter image description here

1

First of all you aren't doing a SUM operation, but rather COUNT. Second of all, Formula type fields cannot roll up child data. There is a separate field type for that requirement called Rollup Summary Field. However, this field type is restricted to only aggregate child data from Master-Detail relationships (except for a few standard objects, but certainly not Event).

A common workaround to this restriction is to use a rollup helper tool such as Declarative Lookup Rollup Summaries which will build triggers for you that calculate the rollup. DLRS is robust and 100% configurable.

Once you install the package, you would simply create a Lookup Rollup Summary record which specifies the Child Object (Event), Parent Object (Campaign), Relationship Field (WhatId ?), Aggregate Operation (Count), and Aggregate Results Field (e.g. Activity_Count__c).

Make sure you use the correct API Names. You can add criteria as well, so you would craft a second Lookup Rollup Summary whose fields are all the same as the first except you add a criteria like: Completed_Event__c = 'Completed'.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.