function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PappuPappu 

Insufficient access

Hi, 
I am trying to view the listview in lightning component. 
I have created a lightning app & lightning componet and added the component to lightning app builder.
There is no error in developer console. But, when i am viewing the component in salesforce app, it throwing "You don't have access to this record. Ask your administrator for help or to request access." My profile is set to System administrator.
It only happens when i use LDS.
Please suggest me some workaround for this. Below is my code.

Lightning App:

<aura:application implements="force:appHostable">
    <ltng:require styles="/resource/SLDS100/styles/salesforce-lightning-design-system.min.css"/>
    <c:Listview_Newmethod1_1 />
</aura:application>

Lightning Component:

<aura:component controller="LGTN_AccountController" implements="force:appHostable,flexipage:availableForAllPageTypes" access="global">
   <ltng:require styles="/resource/SLDS100/styles/salesforce-lightning-design-system.min.css"/>
   <aura:dependency resource="markup://force:navigateToList" type="EVENT"/>
   <aura:dependency resource="markup://force:navigateToSObject" type="EVENT"/>
     <ui:button label="List View" press="{!c.gotoList}"/>
</aura:component>

Controller:

({
gotoList : function (component, event, helper) {
    var action = component.get("c.getListViews");
    action.setCallback(this, function(response){
        var state = response.getState();
        console.log('clicked');
        if (state === "SUCCESS") {
            var listviews = response.getReturnValue();
            var navEvent = $A.get("e.force:navigateToList");
            navEvent.setParams({
                "listViewId": listviews.Id,
                "listViewName": null,
                "scope": "Request__C"
            });
            navEvent.fire();
        }
    });
    $A.enqueueAction(action);
},
})

Class:

public with sharing class LGTN_AccountController {

   @AuraEnabled 
   public static ListView getListViews(){
       return [SELECT Id, Name FROM ListView WHERE SobjectType = 'Request__C' LIMIT 1].get(0);
    }
}
Sitanshu TripathiSitanshu Tripathi
Please once use this code on your component and then try to test, maybe it work for you.
<aura:component controller="LGTN_AccountController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global">

 
PappuPappu
No luck :( :(