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

    application solution

    Popular Salesforce Blogs

    Batch Apex Chaining

    Learn All About Batch Apex Chaining in Salesforce

    Blog in Salesforce Apex

    Batch apex enables the user to do a single job by breaking it into multiple chunks which are processed separately. Batch apex is useful when…

    Apex Scheduler, Asynchronously in Salesforce, Batch Apex, Batch Chaining, Batch Class
    Anjali May 11, 2021
    21,757  Views

    Salesforce - Hubspot Integration #1: Setup Salesforce Integration with Hubspot

    Blog in Salesforce integration

    Setup Salesforce Integration with Hubspot You might have came across various Salesforce integration with different third party tools to widen the business with more customers…

    Authentication Configuration, Hubspot, Production Environment, Salesforce Account, Salesforce Contacts
    Parul Sep 11, 2018
    5,146  Views

    Choosing the Right Salesforce Support Partner in India

    Blog in Salesforce Consultant

    Selecting the right Salesforce support partner is crucial for unlocking the full potential of your Salesforce investment, especially in a vibrant and competitive market like…

    Best Salesforce Partner India, Business Growth, Cost-Effective Salesforce, Cultural Fit Salesforce, Customer References
    Codleo Sep 18, 2024
    1,352  Views

    Popular Salesforce Videos

    Integer Datatype | Primitive Datatypes in Apex | Salesforce Development Tutorials

    Integer Datatype | Primitive Datatypes in Apex | Salesforce Development Tutorials

    Video in Salesforce Apex

    Shrey covered the following questions in this video: What are the different types of Datatype? What are Primitive Datatypes? What is the Long datatype? What…

    Salesforce Training, Salesforce Tutorial, Salesforce Development, Salesforce Apex, salesforce
    S2 May 2, 2022
    1,645  Views
    Salesforce Communities: 5 Powerful Ways to Drive Growth

    Salesforce Communities: 5 Powerful Ways to Drive Growth

    Video in Salesforce Communities

    Salesforce Communities are brand spaces designed specifically for Salesforce customers to connect with the community outside their org (i.e., employees, partners, and customers) and collaborate…

    Salesforce Training, Salesforce Tutorial, Salesforce Video, Salesforce Learning, Salesforce Customers
    Nauman May 11, 2022
    5,129  Views
    Meet the Salesforce Singapore Small Business Relief Grants Recipients

    Meet the Salesforce Singapore Small Business Relief Grants Recipients

    Video in Salesforce Stories

    Small businesses are the heart of our community and the driver of the economy. Salesforce and Singapore Business Federation are pleased to announce the successful…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Community, Salesforce Video
    Nauman Apr 2, 2021
    1,840  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

    © 2025 - 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.