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

    Lightning Web Component

    Call Lightning Web Component From a Quick Action in Salesforce

    Blog in Lightning, Salesforce Tutorial

    In Lightning, still, you can't call an LWC component from quick action straightforwardly. An LWC component should be wrapped inside an Aura Component and Aura…

    Aura Component, Immediate Strategy, JS File, Lightning, Lightning Web Component
    Anuj Dec 23, 2020
    16,810  Views

    Why and how do you migrate to Salesforce Lightning?

    Blog in Lightning

    Why move to Salesforce Lightning right now? Salesforce Lightning is the Salesforce brilliant feature with interactive UI that provides intuitive tools and services to automate…

    Lightning App Builder, Sales Automation, Salesforce, Salesforce Einstein, Salesforce Lightning
    AwsQuality Nov 7, 2019
    3,391  Views
    Lightning App Manager

    Lightning App Manager in Salesforce - All you Need to Know

    Blog in Others

    Lightning App In Salesforce An app is a group of components that work together to accomplish a certain task. With Lightning Experience, your users can…

    App Manager, App Manager in Salesforce, App Personalization, Custom Objects, Data Model
    Ashish Sep 7, 2022
    6,059  Views

    Popular Salesforce Videos

    Experience the Most Flexible, Easiest, and Securest Way to Integrate Salesforce and Jira

    Experience the Most Flexible, Easiest, and Securest Way to Integrate Salesforce and Jira

    Video in Salesforce Integration

    Integrate standard and custom Salesforce objects with Jira to strengthen cross-functional collaboration and deliver a top-notch customer experience. Fast-Track Your Journey to Attaining Customer Centricity…

    salesforce, Salesforce Video, Salesforce Learning, Customer Experience, jira
    Shubham Oct 14, 2020
    2,036  Views
    Use cases Automation UiPath with Salesforce

    Use cases Automation UiPath with Salesforce

    Video in Salesforce Automation

    The following video demonstrates a UiPath Robot automatically populating Salesforce using data read from an Excel spreadsheet....imagine how UiPath Robots could accelerate your Salesforce activities.…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Video, Salesforce Learning
    Cristian Dec 8, 2020
    2,616  Views
    Top 4 Ways Sales Leaders at Salesforce Use Einstein Analytics

    Top 4 Ways Sales Leaders at Salesforce Use Einstein Analytics

    Video in Salesforce Einstein

    Here's a peek behind the curtain at four of the top ways sales leaders at Salesforce use Einstein Analytics to manage pipeline and coach their…

    Salesforce Training, salesforce, Salesforce Einstein, Salesforce Video, sales
    Neha Yadav Sep 29, 2020
    1,575  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®.

    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.