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
Aliaksei RazumauAliaksei Razumau 

Roll-up summary custom field in Campaigns

I want to add a field to a Campaign which calculates number of CampaignMembers meeting some criteria. In my case, every CampaignMemeber has a checkbox field which shows whether CampaignMember is an existing customer or not. I want to calculate number of customers and display number in Campaign.

How I can do it without writting apex code?

I started creating a field:
1. Chose formula type - I couldn't find CampaignMember object and, as the result, any custom fields, it just doesn't exist. I don't know why? Logically it should be.
2. Chose Roll-up field - I can count number of CampaignMembers but in criteria who'd be included I didn't find any custom CampaignMember fields.

As far as I see now, Campaigns are imature and it differs from other standard objects (e.g. Contacts and Accounts has same relationship). Why?! 
PratikPratik (Salesforce Developers) 
Hi Aliaksei,

This can be done without coding.

Through checkbox:

User-added image



Without Checkbox:

Instead of checkbox on campaignmember, use picklist value (with valur Yes & No) and then create rollup summary field on Campaign and pur criteria on Picklist value = Yes.

Custom fields of Campaignmember will be shown on Campaign rollup summary formula.

Screenshot:

User-added image

Thanks,
Pratik

P.S. If this answers you question, please mark it as "Best Answer" so it will help other community members too.
 
Aliaksei RazumauAliaksei Razumau
That's exactly what I did. Created a checkbox in Campaign Members object. How do you have what I don't? Here's what I have:

Example
In a dropdown list I can see only Campaign fields but not CampaignMember fields.
PratikPratik (Salesforce Developers) 
Hi Aliaksei,

All custom field on campaignmember will be shown. Can you try creating any other field on campaignmember.

Thanks,
Pratik
Aliaksei RazumauAliaksei Razumau
Hi Pratik,

thanks for your help. What did you mean by saying to create any other field on campaignmember?

I have bunch of fields on campaignmember including text, picklist and checkbox fields, but none of them is shown when you create a roll up or formula field on campaign object. As I can see the only fields available there are entirely campaign fields, do you have different experience?

Alex
PratikPratik (Salesforce Developers) 
Hi Aliaksei,

Here is the screenshot:

User-added image


I am trying this on my developer org. 

Thanks,
Pratik
Jason HowieJason Howie
Aliaksei or Pratik,

Have you found a solution for this? I basically want to do the same thing and have not found a good method for it.

Thanks!
-Jason
 
Roshni RahulRoshni Rahul
Hi Jason and Aliaksei,

First we have to create a custom field for Campaign Member using checkbox. ( I have given the name of the field as Existing Member)

Next step is to create a rollup summary field from Campaign Object to Campaign Member Object.


User-added image
Set the filter condition as true if the existing member equals true.

To Check whether you are getting the result, add a member to the Campaign Member(which you can see in the detail page of Campaign Object).

User-added image
You can add Members to Campaign members by searching. 

User-added image
If you are not getting the created custom checkbox field, click the edit buttton in which you can add the fields.

User-added image

After adding members,you can check or uncheck the existing member

User-added image

Now you could see that the no: of employee count in the Campaign object will be set as 1 since i have included only one member.


Hope this is your requirement.

Thanks,
Roshni