Toggle Side Panel

  • Blogs
  • 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
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Blogs
    • 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
    • Contact Us
    • Discussions
    Close search

    Activity › Forums › Salesforce® Discussions › How can we get the distinct account name of account object on Salesforce?

    Tagged: Account, Person Account, Salesforce Objects

    • Salesforce® Discussions

      How can we get the distinct account name of account object on Salesforce?

      Posted by Mohit on July 21, 2016 at 3:17 PM

      Hi all,

      How can we get the distinct account name of account object on Salesforce?

      Please give suggestions.

      • This discussion was modified 10 years, 1 month ago by  Mohit.
      • This discussion was modified 10 years, 1 month ago by  Forcetalks.
      • This discussion was modified 10 years, 1 month ago by  Forcetalks.
      Sourabh replied 10 years, 1 month ago 2 Members · 1 Reply
      • Account
      • Person Account
      • Salesforce Objects
    • 1 Reply
    • Sourabh

      Member
      July 25, 2016 at 6:59 AM

      Hi Mohit,

      Giving you the code for getting distinct Account name using 'set'...

      List<Account> acclist = new List<Account>();

      Set<String> setName = new Set<String>();

      acclist = [select id,Name other fields from Account] ;

      for (Integer i = 0; i< acclist.size(); i++)

      {

      setName.add(acclist[i].Name); // It will contains distinct accounts.

      }

      Thanks

    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

    Popular Salesforce Blogs

    Migrating to Salesforce Marketing Cloud with Zero Downtime

    Migrating to Salesforce Marketing Cloud with Zero Downtime

    Blog in Salesforce

    Enterprise marketing relies heavily on continuous data processing. Modern brands run campaigns around the clock across global time zones. A sudden halt in customer communication…

    Salesforce Marketing, Salesforce Marketing Cloud
    James Jun 26, 2026
    616  Views
    Subscription Models That Stick Building Recurring Revenue Streams on Salesforce Commerce Cloud

    Subscription Models That Stick: Building Recurring Revenue Streams on Salesforce Commerce Cloud

    Blog in Salesforce

    Subscription services dominate modern digital retail. The global commerce cloud market reached 21.9 billion dollars in 2025. Experts project this market will reach 113.56 billion…

    Cloud Commerce Solution, Salesforce Commerce Cloud
    James Jun 19, 2026
    308  Views

    Essentials Question To Gauge Digital Transformation Of An Organization | Salesforce Guide

    Blog in Salesforce

    In an internet-driven world that demands an online presence to stay in tune with the evolving marketplace, every industry needs to keep up with the…

    Application Development, Business Goals, Business Models, Charities, CRM Solutions
    Apphienz Jun 3, 2021
    1,965  Views

    Popular Salesforce Videos

    Salesforce for Manufacturing: How to Digitize Your Sales Processes

    Salesforce for Manufacturing: How to Digitize Your Sales Processes

    Video in Salesforce Stories, Salesforce Products

    As a manufacturing sales leader, you’re looking for ways to go digital with your sales processes and improve channel performance. In this video, you’ll learn…

    Salesforce Training, Salesforce Video, Salesforce Lerning, Sales Process, Salesforce for Manufacturing
    Rupal Kakkar Mar 9, 2021
    1,949  Views
    What are Roll-up Summary Fields in Salesforce? | How to create them?

    What are Roll-up Summary Fields in Salesforce? | How to create them?

    Video in Others, Salesforce Training

    In this video, Shrey is not only teaching but also demonstrating to you "What are Roll-up Summary Fields in Salesforce?". You will be learning: 1.…

    Salesforce Training, salesforce, Salesforce Video, Salesforce Learning, Journey with Salesforce
    Rupal Kakkar Sep 28, 2020
    1,926  Views
    How to Create Custom Field in Lighting Experience | Salesforce

    How to Create Custom Field in Lighting Experience | Salesforce

    Video in Lightning, Salesforce Training

    Fields you create on standard or custom objects are called custom fields. You can create a custom field on the Contact object to store your…

    Salesforce Training, Salesforce Tutorial, Salesforce Video, Salesforce Learning, Custom Objects
    Abhishek Dec 29, 2021
    1,831  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®.

    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.