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

    Triggers in Salesforce - Learn All You Need to Know

    Blog in Salesforce Tutorial

    What is Apex Trigger? Apex Triggers are used to refer to triggers in Salesforce. These are different and are accessible for particular tasks such as…

    Apex Trigger, API calls, Before Trigger, Bulky Triggers, Cloud Computing
    MindMajix Jan 27, 2022
    6,555  Views

    How to Hire Salesforce CPQ Developer for Business Success

    Blog in Salesforce

    In the competitive world of B2B sales, speed and accuracy are the dual engines of growth. However, as product catalogs grow and pricing structures become…

    Hire Salesforce CPQ Developer, Salesforce CPQ Consulting Services, Salesforce CPQ Services
    Dean Mar 13, 2026
    381  Views
    Custom MetaData Types

    All About Custom MetaData Types | The Salesforce Developer Guide

    Blog in Data, Others, Salesforce

    Custom metadata is packageable, adjustable, upgradeable, and deployable application metadata. To start with, you make a custom metadata type, which characterizes the type of application…

    Application Metadata, CSV File, Custom Fields, Custom Fields Values, Custom Metadata
    krati vishnoi Dec 24, 2020
    4,101  Views

    Popular Salesforce Videos

    Volunteer Management in Salesforce Nonprofit Cloud

    Volunteer Management in Salesforce Nonprofit Cloud

    Video in Salesforce Cloud Platform

    Volunteers are a crucial part of many nonprofit organizations. With Volunteer Management in Nonprofit Cloud, you can improve every step of the volunteer process from…

    salesforce, CRM, Digital Transformation, Nonprofit, Nonprofit Cloud
    DB Nov 25, 2025
    345  Views
    Manual & Apex Managed Sharing in Salesforce

    Manual & Apex Managed Sharing in Salesforce

    Video in Salesforce Apps

    In this video, we will talk about Manual Sharing and Apex Managed Sharing. Manual Sharing Manual Sharing is used to share the record Manually. For…

    Salesforce Training, salesforce, Salesforce Video, Salesforce Learning, sharing rules
    Jogender Dec 31, 2020
    3,135  Views
    What are Permission Sets (Object Level Security) in Salesforce?

    What are Permission Sets (Object Level Security) in Salesforce?

    Video in Salesforce Security, Salesforce Training

    In this video, Shrey is not only teaching but also demonstrating Permission Sets used in Salesforce Object Level Security. You will be learning: What are…

    Salesforce Training, Salesforce Tutorial, Salesforce Administrator, salesforce, Salesforce Video
    Abhishek Dec 11, 2020
    2,673  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.