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, 2 months ago by  Mohit.
      • This discussion was modified 10 years, 2 months ago by  Forcetalks.
      • This discussion was modified 10 years, 2 months ago by  Forcetalks.
      Sourabh replied 10 years, 2 months 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

    How to Achieve Sales Growth with Salesforce Sales Cloud Implementation

    Blog in Others

    Sales growth is the ultimate goal for businesses aiming to remain competitive and profitable. To achieve consistent results, companies need a robust system that manages…

    Anna Nov 11, 2025
    206  Views
    Salesforce Integration with LinkedIn

    Salesforce Integration with LinkedIn - Here's All You Need to Know

    Blog in Salesforce integration

    The general approach to selling doesn’t work as effectively in today’s world. You cannot expect extraordinary results by pushing out bulk emails to every prospect…

    AppExchange, Bulk Emails, Chrome Extensions, Contact Page Layout, Custom Tool
    Ato Jun 30, 2022
    5,247  Views
    Push Notifications

    Best Practices for Push Notifications and In-App Messaging in Salesforce

    Blog in Others, Salesforce

    You receive them usually — the push notifications once you get a match on a qualitative analysis app or once there’s breaking news, they inform…

    Apple, Application, Application Commitment, Bypass Spam Filters, Email Inbox
    Ratnesh Oct 1, 2020
    5,459  Views

    Popular Salesforce Videos

    Salesforce Connections 2018 Keynote - Ch. 1: Corporate Positioning

    Salesforce Connections 2018 Keynote - Ch. 1: Corporate Positioning

    Video in Events

    Salesforce Connections 2018 Keynote – Ch. 1: Corporate Positioning Salesforce Connections 2018 Keynote – Ch. 2: Ticketmaster Is A Trailblazer Salesforce Connections 2018 Keynote –…

    Salesforce CRM, Salesforce Keynote, Salesforce Connections, Salesforce Events
    Hazel Jun 27, 2018
    1,927  Views
    Sharing and Visibility With Salesforce

    Sharing and Visibility With Salesforce

    Video in Salesforce Stories, Salesforce Training

    Watch this amazing to understand the Salesforce sharing model, and how to structure profiles, roles, and sharing rules to control visibility. Do let us know…

    Salesforce Training, salesforce, Salesforce Video, Salesforce Learning, Sharing and Visibility
    Jogender Nov 20, 2020
    1,995  Views
    Salesforce Lightning Tutorial | Salesforce Developer Training for Beginners

    Salesforce Lightning Tutorial | Salesforce Developer Training for Beginners

    Video in Lightning

    This salesforce developer training for beginners video is a salesforce lightning tutorial where you will learn introduction to salesforce, salesforce components, salesforce lightning, lightning vs…

    Salesforce Training, Salesforce Lightning, salesforce, Salesforce Developers, Salesforce Lightning Platform
    Rupal Kakkar Apr 7, 2020
    2,359  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.