lightinng:listview component is showing error “The list view you requested was deleted, or you don't have permission to view it”

Manjot Singh 08/01/2018. 2 answers, 55 views
lightning-components lightning lightninglistview
<aura:component implements="flexipage:availableForAllPageTypes,force:lightningQuickActionWithoutHeader" access="global">  

    <lightning:listView aura:id="listViewAccounts" objectApiName="Account"
           listName="AllAccounts" rows="5" showActionBar="false"
           enableInlineEdit="true" showRowLevelActions="false"/>


I am using sample code provide by documentation to view list views. But getting error on UI "The list view you requested was deleted, or you don't have permission to view it."

I have added component in contact detail page in lightning.

2 Answers

Jayant Das 08/14/2018.

This is what I observed while testing this out. I tried the same snippet as in the post and received the same error. After few attempts, realized that if at all your org is namespace enabled (mine is), you will need to prefix the namespace to the list view name.

This behavior is definitely not mentioned in the documentation (as of today).

So if your org is namespace enabled, then in order to get this component to work, the code needs to be modified to prefix the namespace in the listName attribtue, something as below:

<lightning:listView aura:id="listViewAccounts" objectApiName="Account"
           listName="mynamespace__AllAccounts" rows="5" showActionBar="false"
           enableInlineEdit="true" showRowLevelActions="false"/>

Manjot Singh 08/01/2018.

@jayant Solution is correct, I just wanted to add some more info here. If we query ListView Object then we can query

SELECT DeveloperName,NamespacePrefix,SobjectType FROM ListView

Then while fetching ListView if Namespaceprefix exist in apex can add NamespacePrefix+__+DeveloperName in apex and pass it to Lightning.

So in lightning

<lightning:listView aura:id="listViewAccounts" objectApiName="Account"
           listName="NamespacePrefix+__+DeveloperName" rows="5" showActionBar="false" enableInlineEdit="true" showRowLevelActions="false"/>

Above approach will work for all cases.

Related questions

Hot questions


Popular Tags