Dynamic ListView – Based on selected object

Dynamic ListView – Based on selected object

In this post, let’s explore more and create a dynamic listview. We will see:

  • How to show available listview based on object selection
  • Show object records based on listview selection

Component – ListViewComponent.cmp



Client Side Controller – ListViewComponentConroller.js



Client Side Helper- ListViewComponentHelper.js



Server Side Controller – ListViewController.apxc



Feel free to provide your feedback and suggestions.

With this post, please welcome our new author “Shaik Nagajani”.SFDCFacts appreciates his effort in sharing the knowledge and giving back to the community. Read more about him below.

Shaik Nagajani

I am Salesforce Developer since 2015, Previously I Worked in TechM. Currently, I am Working As Senior Salesforce Developer In DXC Technology Pvt Ltd. and I am PD1 Certified Salesforce Developer. Knowledge of Sales Cloud, Service Cloud, Apex, Visualforce, Javascript, Lightning Framework.

This Post Has 11 Comments

  1. Avatar

    Hey! there,
    I got following error:
    afterRender threw an error in ‘lightning:listView’ [[lightning:listView] Unsupported objectApiName: opportunity]
    Failing descriptor: {lightning:listView}

    1. Shaik Nagajani

      Hi Eshan,

      Please Enter Exact API Name of Object,
      Ex:
      Standard Object: Opportunity, Account, Case, Lead, Contact, etc.
      For Custom Object: Position__c, Job_Application__c etc…
      Please Check and Let me Know If you Have any Queries.

  2. Avatar

    Hi Shaik,
    That error was because I was putting API name of an object in lower case.
    Thanks!

    1. Avatar

      Yes, Since Lightning is Case-Sensitive, it expects exact letter case even for object name.

  3. Avatar

    Is there any way to make this work with User object?

  4. Avatar

    Doesn’t work for user object

  5. Avatar

    Hi
    Can we display the result in the same place where we seach?

  6. Avatar

    Hi,
    I got an Error:
    I selected required Object and selected name from Drop Down list, then I am getting a message as “The list view you requested was deleted, or you don’t have permission to view it”..I am not getting the list view of the object.How to solve this?

  7. Avatar

    Good afternoon from Greeece, thank you so much for sharing your compounded knowledge with all of us, especially with us the non coders. I am following your lightning component YouTube videos and I admit that for a person with no coding experience they present a wealth of knowledge. Your videos provide concise steps and assist me a lot in gaining the necessary understanding.

    While trying to interact with the above component I came across the following error messages, having no coding experience I would greatly appreciate the reason behind so that I can try and rectify it (if possible)

    I am receiving same error – The list view you requested was deleted, or you don’t have permission to view it — Despite setting the list view to accessible from all.

    When searching standard objects: The above error displays for all list views except the – My accounts, My contacts, My opportunity
    When searching custom objects:The above error displays when I choose anything else than the all list view

    Once again thank you for your support and for sharing your knowledge

  8. Avatar

    What is the use of doing this here when we already have a standard page ?? I can’t find this any more useful than my standard page. All functionality are already given by salesforce then what is the use of making this component.?

Leave a Reply

Close Menu