Toggle Side Panel

  • Home
  • Articles
    • All Articles
    • Blogs
    • Videos
    • Infographics
  • Consultants
    • Salesforce Product Expertise
      • Top Salesforce ConsultantsTop Salesforce Consultants
      • Marketing Cloud ConsultantsMarketing Cloud Consultants
      • Service Cloud ConsultantsService Cloud Consultants
      • Experience Cloud ConsultantsExperience Cloud Consultants
      • Analytics Cloud ConsultantsAnalytics Cloud Consultants
    • Salesforce Industry Expertise
      • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
      • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
      • Health Cloud ConsultantsHealth Cloud Consultants
      • Commerce Cloud ConsultantsCommerce Cloud Consultants
      • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
    • Salesforce Experts by Location
      • USATop Salesforce Consultants in USA
      • IndiaTop Salesforce Consultants in India
      • AustraliaTop Salesforce Consultants in Australia
      • United KingdomTop Salesforce Consultants in UK
      • CanadaTop Salesforce Consultants in Canada
  • Webinars
  • Marketplace
  • Advertise With Us
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Home
    • Articles
      • All Articles
      • Blogs
      • Videos
      • Infographics
    • Consultants
      • Salesforce Product Expertise
        • Top Salesforce ConsultantsTop Salesforce Consultants
        • Marketing Cloud ConsultantsMarketing Cloud Consultants
        • Service Cloud ConsultantsService Cloud Consultants
        • Experience Cloud ConsultantsExperience Cloud Consultants
        • Analytics Cloud ConsultantsAnalytics Cloud Consultants
      • Salesforce Industry Expertise
        • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
        • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
        • Health Cloud ConsultantsHealth Cloud Consultants
        • Commerce Cloud ConsultantsCommerce Cloud Consultants
        • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
      • Salesforce Experts by Location
        • USATop Salesforce Consultants in USA
        • IndiaTop Salesforce Consultants in India
        • AustraliaTop Salesforce Consultants in Australia
        • United KingdomTop Salesforce Consultants in UK
        • CanadaTop Salesforce Consultants in Canada
    • Webinars
    • Marketplace
    • Advertise With Us
    • Contact Us
    • Discussions
    Close search

    Activity › Forums › Salesforce® Discussions › How to count unique accounts from the campaign member related list?

    Tagged: Account, Related List, Salesforce Apex, Salesforce SOQL, Salesforce Trigger

    • Salesforce® Discussions

      How to count unique accounts from the campaign member related list?

      Posted by Nitish on April 30, 2016 at 5:23 PM

      How to count unique accounts from the campaign member related list on the campaign detail page?

      • This discussion was modified 9 years, 7 months ago by  Nitish.
      • This discussion was modified 9 years, 7 months ago by  Forcetalks.
      • This discussion was modified 9 years, 7 months ago by  Forcetalks.
      Gourav replied 9 years, 7 months ago 2 Members · 1 Reply
      • Account
      • Related List
      • Salesforce Apex
      • Salesforce SOQL
      • Salesforce Trigger
    • 1 Reply
    • Gourav

      Member
      June 2, 2016 at 1:57 PM

      There is no configuration through which this can be achieved easily. This can be done via a trigger.

      Create a trigger on CampaignMember for after insert, after update, after delete and after undelete.
      Get the unique campaign Ids from Campaign Members
      Create a aggregate query and group by Campaign Id and Account Id.
      The aggregate query should be able to give you the unique count which you can update on Account. You might also require triggers on Contact and Account for handling situations such as Account update on Contact, Contact deletion, Account deletion.

    Log In to reply.

    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me

    application solution

    Popular Salesforce Blogs

    Aura Components in Salesforce

    Overview of Aura Components in Salesforce | The Developer Guide

    Blog in Salesforce Apex

    Aura The modular, reusable parts of an app are called aura components. From a single line of text to a whole app, they stand for…

    Application Events, AURA, Aura Components, Aura Interfaces, Aura:component Tag
    ashutosh pandey Oct 7, 2022
    4,567  Views
    apex to lightning

    How to Convert sforce.apex.execute to Lightning | Salesforce Developer Guide

    Blog in Lightning, Salesforce Apex

    Introduction In this blog, we will learn how to directly call the apex class through a custom button or javascript button on the object detail…

    Creating Custom Buttons, Custom Button, Detail Page, JavaScript, JavaScript Button
    Kirandeep Feb 25, 2021
    11,634  Views

    10 Hottest Salesforce Features to Simplify Your Business Tasks

    Blog in Salesforce

    In today’s digital age, businesses must innovate to build strong customer relationships, streamline operations, and drive growth. Salesforce, a leading customer relationship management (CRM) platform,…

    Business Tasks, Collaboration Tools, Contact Management, Conversion Rates, Customer Data
    Codleo Jul 26, 2024
    1,342  Views

    Popular Salesforce Videos

    MuleSoft Integration: Google Ads Lead Form to Salesforce - Learn Salesforce Series by Algoworks

    MuleSoft Integration: Google Ads Lead Form to Salesforce - Learn Salesforce Series by Algoworks

    Video in Salesforce Integration, Salesforce Training

    MuleSoft integration: Google Ads lead form to Salesforce. In this video, learn how MuleSoft can be used to integrate Salesforce with Google Ads lead form.…

    Salesforce Development, Salesforce Integration, salesforce services, Salesforce Cloud, Salesforce Video
    Algoworks May 27, 2020
    2,823  Views
    Salesforce and Slack: Success from Anywhere - Your Digital HQ

    Salesforce and Slack: Success from Anywhere - Your Digital HQ

    Video in Salesforce Stories

    Welcome to Success from Anywhere: Your Digital HQ. Join our Slack-First Customer 360 event to find out more. Register now: https://www.salesforce.com/events-master/digital-hq/ Success Anywhere means coming…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Video, Customer 360
    Nauman Jul 22, 2021
    2,093  Views
    Get Started with Salesforce Elevate

    Get Started with Salesforce Elevate

    Video in Salesforce Stories

    Salesforce is a powerful tool to analyze your past fundraising, and monitor your ongoing efforts. In this webinar, we'll start with the fundamentals -- understanding…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Webinar, Salesforce Video
    Prafull Feb 4, 2022
    2,204  Views
    Footer Forcetalks logo

    support@forcetalks.com

    • twitterx

    Quick Links

    Advertise with Us

    Salesforce® Articles

    Dreamforce 2023

    Top Salesforce® Bloggers 2023

    Top Salesforce Consultants

    Get Listed

    Company

    Contact Us

    About Us

    Privacy Policy

    Terms & Conditions

    InsightHub

    Salesforce Blogs

    Salesforce Videos

    Salesforce Groups

    Salesforce Jobs

    © 2026 - Forcetalks ● All Rights Reserved

    Salesforce® is a trademark of Salesforce® Inc. No claim is made to the exclusive right to use “Salesforce”. Any services offered within the Forcetalks website/app are not sponsored or endorsed by Salesforce®.

    Try AuditMyCRM - It is a Salesforce CRM Audit tool which comprehensively scans your Salesforce org and gives you the list of errors or warnings you need to take care of.
    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.