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 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 2 years, 8 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.

    • 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

    application solution

    Popular Salesforce Blogs

    Salesforce Sales Cloud - The Complete Guide

    Blog in Sales, Salesforce Cloud Platform

    Introduction As we already know Salesforce CRM helps every industry to win more deals, manage the business efficiently and to build strong relationships with customers.…

    Benefits of Salesforce, Guide, Lightning, Sales Cloud, salescloud
    Emorphis Aug 8, 2022
    5,492  Views

    FlexDeploy Loves Salesforce: Source Control Your Salesforce Changes

    Blog in Salesforce integration

    FlexDeploy is an Enterprise DevOps platform with fully integrated support for Salesforce apps, metadata customizations, integrations and more. This is the second article in a…

    Blueprints, Change Management Tools, Client ID, Cloud Integration, Communication Tools
    Flexagon Dec 16, 2021
    2,213  Views
    Salesforce Files

    Objects Related To Salesforce Files And Connection Between Them

    Blog in Data, Lightning, Salesforce

    As we know most of the work has been shifted to Lightning Experience. The questions arise in the mind of users when Salesforce Classic provides…

    Attachments, Chatter Free license, Contact Manager, Contact related Files, Content
    Deepak Jul 21, 2020
    20,242  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.