I am customizing our Campaign page and adding a field called "Total Participants". I want to only count Campaign Members whose status is not equal to "No Show", "Not Attending". This is simple to do in a report, but I'm not sure how to incorporate it into a formula.

I found this Salesforce forum post, but from my understanding it would require creating a new report for each Campaign.

The best I can come up with is:

// LEN(GETRECORDIDS()) gets total number of records from a certain object
// `Self` is wrong but I'm not sure how to reference the current object's sub-objects

Self.CampaignMember.Status != "Not Attending") && (Self.CampaignMember.Status != "No Show")

I'm betting this is far off base, but I'm not sure what direction to take this while keeping to the confines of a formula field.

  1. Create a new Rollup Summary field on Campaign.
  2. Select Summarized Object > Campaign Members.
  3. Select Roll-Up Type > COUNT.
  4. Select Filter Criteria > Only records meeting certain criteria should be included in the calculation.
  5. Select Field > Status.
  6. Select Operator > not equal to.
  7. Use the lookup dialog to select the picklist options to ignore.
  • does rollup summary fields work for lookup relation? As relation between Campaign and Campaign Member is lookup not master detail. – Tara Mar 14 '16 at 21:24
  • @Tara Take a look for yourself in the UI, it is available. You can install declarative-lookup-rollup-summaries to work with lookups when OOB Rollup Summary Fields are not available. – Adrian Larson Mar 14 '16 at 21:27
  • @Tara -- You pointed out something odd - the Setup | Customize | Campaign Member | Fields does indeed show Campaign as a Lookup relationship but Adrian is right in that RSF can be done from Campaign -> CM. This relationship is a cascade delete relationship which is an indicator for master-detail – cropredy Mar 14 '16 at 22:15
  • @crop1645 Yeah I just assumed it was M/D when I was able to create RSF. Pretty weird behavior. It is also a required lookup. – Adrian Larson Mar 14 '16 at 22:17
  • I suspect this is a legacy from some long ago SFDC - Winter '88 or the like – cropredy Mar 14 '16 at 22:19

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.