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

    Device Authorization Flow

    OAuth 2.0 Device Authorization Flow in Salesforce

    Blog in Salesforce Stories

    For input-restricted devices that connect to the Internet, instead of authenticating the user directly, the device prompts the user to go to a link on…

    API, App, Authentication Flow, Authentication Process, Authorization
    Nikhil Kumar Nov 11, 2022
    4,075  Views

    Apex Trigger Scenarios – Part 1

    Blog in Salesforce Apex

    Some Important Questions Write a trigger to throw error when user deactivates the account record and if that account has atleast one opportunity with the…

    API, Batch, Before update, Contact, Context Variables
    SF Jul 11, 2023
    4,073  Views
    Collections in Salesforce

    Learn All About Collections in Salesforce: List, Set and Map

    Blog in Salesforce

    In this Blog, we will study collections in Salesforce. List  It is an ordered collection of elements. Each element of the list has a unique…

    Built-in Type, Collection, Collections in Apex, Collections in Salesforce, Duplicate Elements
    bhawana Jan 4, 2023
    2,832  Views

    Popular Salesforce Videos

    Salesforce Interview Questions and Answers - For Freshers and Experienced Candidates

    Salesforce Interview Questions and Answers - For Freshers and Experienced Candidates

    Video in Salesforce Stories, Salesforce Training

    Learn most important Salesforce Interview Questions and Answers, asked at every interview. These Interview questions will be useful to all entry-level candidates, beginners, interns, and…

    Salesforce Developers, Salesforce Training Video, Salesforce Interview Questions, Interview Questions and Answers, Salesforce Interview Questions and Answers
    Neha Yadav Jun 2, 2020
    2,000  Views
    Clean Code in Salesforce | Code Review

    Clean Code in Salesforce | Code Review

    Video in Others, Salesforce Stories

    We spend more time reading our code than writing it. So doesn't it make sense that our code is clean, precise, and easy to read?…

    Salesforce Training, salesforce, Salesforce Video, Salesforce Learning, Clean Code in Salesforce
    Jogender Jun 30, 2020
    1,844  Views
    Salesforce Chatter Tutorial | Chatter Overview And Demo | Chatter In Salesforce

    Salesforce Chatter Tutorial | Chatter Overview And Demo | Chatter In Salesforce

    Video in Salesforce Apps

    This Salesforce Chatter Tutorial will give an overview of Chatter which includes enabling chatter, configuring chatter groups and creating customer groups. Salesforce Chatter will be…

    Salesforce Training, Salesforce Chatter, Salesforce Online Training, Salesforce Developer, Salesforce Demo
    Simplilearn Apr 23, 2019
    4,585  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.