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, 6 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

    How Can Salesforce Help Your Marketing Team?

    Blog in Salesforce

    Although CRMs have traditionally been linked to sales teams, Salesforce has gone further to provide great solutions for the Marketing department. Its Marketing Cloud platform…

    approach, builders, Campaigns, connected, CRM
    SkyPlanner Feb 23, 2024
    1,318  Views
    What is Pardot? What is Engagement History in Salesforce in 2023?

    What is Pardot? What is Engagement History in Salesforce in 2023?

    Blog in Others

    Pardot is a software as a service (SaaS) marketing automation platform by SalesForce offering email automation, targeted email campaigns, and lead management for B2B sales…

    Engagement History, Engagement History Dashboard, pardot, Pardot AI, Prospects and Leads
    Mohit Kumar Jan 10, 2023
    2,635  Views
    Net Zero Cloud

    Dig Deeper into Salesforce Net Zero Cloud | The Ultimate Guide

    Blog in Others

    In our last blog, we told you about one of the latest products from Salesforce called Net Zero Cloud designed to help businesses measure and…

    Carbon Emissions, Carbon Footprints, Climate Change, Corporate Reputation, CRM Analytics
    Stimulus Consulting Apr 12, 2023
    1,237  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.