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 to fetch list view columns without using MetaData Api Call?

    Tagged: List View, Metadata API, Salesforce Apex, Salesforce SOQL

    • Salesforce® Discussions

      How to fetch list view columns without using MetaData Api Call?

      Posted by Neha on April 8, 2016 at 12:00 PM

      When I click button on list view, I want to fetch list view column's api name without using metadata api call.

      Shuvam replied 3 years, 3 months ago 5 Members · 6 Replies
      • List View
      • Metadata API
      • Salesforce Apex
      • Salesforce SOQL
    • 6 Replies
    • Anup

      Member
      April 13, 2016 at 9:44 AM

      Hi Neha,

      Metadata APi would be needed to be consumed if we are wanting to get the ListView Column names. Can I some more Insights to the requirement if this does not help answer your query. May be I would be of more of a help then.

    • [adinserter block='9']
    • Neha

      Member
      April 13, 2016 at 10:36 AM

      Hi Anup,

      I need to access listview with non-admin user for fetching dynamic coloumn in respect of current listview.

    • Neha

      Member
      April 14, 2016 at 8:19 AM

      Thanks Anup

      Please refer below link for solution related to above query.

      http://forcetalks.com/blog/running-metadata-api-in-apex-as-a-specific-user/

    • Ajay Prakash

      Member
      February 11, 2018 at 3:23 PM

      Hi Neha,

      You can retrieve the records based on the list view id using HTTP request. It can be done without consuming WSDL. You can use below code for reference -

      public static List<Account> getFilteredAccounts(String filterId){
      HttpRequest req = new HttpRequest();
      String baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
      String endPoinURL = baseUrl+'/services/data/v32.0/sobjects/Account/listviews/'+filterId+'/describe';
      req.setEndpoint(endPoinURL);
      req.setMethod('GET');
      req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionId());
      Http http = new Http();
      HTTPResponse response = http.send(req);
      Map<String, Object> tokenResponse = (Map<String, Object>)                 JSON.deserializeUntyped(response.getBody());
      String query = (String) tokenResponse.get('query');
      List<Account> AccountList = new List<Account>();
      for(Account accountObj : database.query(query)){
      AccountList.add(accountObj);
      }
      return AccountList;

      }

      In the above example, I have retrieved accounts based on the selected list view. Any other profile which is API enabled and has read access on the Account object can retrieve the records.

    • Unknown Member

      Member
      April 13, 2023 at 11:50 AM

      but this get only some fields not all the fields, why?

    • Shuvam

      Member
      May 17, 2023 at 2:35 PM

      Fetching list view columns without using Metadata API in Salesforce can be tricky because the list view columns are not directly available via any standard object or SOQL query. However, you can use the ListView describe call from the REST API, which will give you the list view's columns along with other information.
      Here's an example of how you might do this in Apex:
      public class ListViewColumns {
      public static void getListColumns() {
      String sObjectApiName = 'Account'; // replace with your sObject API Name
      String listViewId = '00BT0000001Kxmu'; // replace with your List View Id
      HttpRequest req = new HttpRequest();
      req.setEndpoint(URL.getSalesforceBaseUrl().toExternalForm()
      + '/services/data/v53.0/sobjects/'
      + sObjectApiName + '/listviews/'
      + listViewId + '/describe');
      req.setMethod('GET');
      req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionId());
      Http http = new Http();
      HttpResponse res = http.send(req);
      System.debug(res.getBody());
      }
      }
      The debug log will show the JSON response of the ListView describe call, which includes the columns in the list view.
      Please note that this requires the user to have access to the list view and the sObject, and it involves a callout, so it can't be used in triggers or synchronous processes that don't allow callouts.

    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

    Salesforce Pardot

    How Salesforce Pardot AI Boosts Email Engagement? | Learn Here

    Blog in Salesforce Einstein, Salesforce Products

    Email marketing is getting more and more competitive with businesses looking to improve their email marketing by increasing the click-through rate (CTR) and conversions. While…

    Artificial Intelligence, Behaviour Pattern, Click-through Rate, Communication Tool, Customer Data
    Melonleaf Nov 17, 2022
    2,755  Views
    Salesforce Developers

    In house vs. Outsource Salesforce Development Team

    Blog in Salesforce Consultant

    Salesforce is the world’s number one cloud-based Customer Relationship Management (CRM) product that allows companies to identify, keep track of, and strengthen relationships with existing…

    Applications for Sales, Backup Resource, Business Benefits, Business Needs, Business Process
    Iqra Nov 16, 2021
    7,746  Views
    Tips for CRM implementation

    12 Tips To Consider Before Implementing A CRM System For Your Business

    Blog in Others

    There is a much fuss about the CRM systems across the IT and cloud managing services. Everyone is trying way too hard to keep up…

    CRM, CRM Implementation, Salesforce CRM
    William Aug 27, 2018
    4,171  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.