Loading

Experience Cloud Site Error: Blank Page or Lightning Component fails to load for Guest User or Experience Site User

Veröffentlichungsdatum: Jul 11, 2024
Beschreibung
If your Lightning Component has an apex controller attached, and if that apex controller has code which queries the Knowledge Object (Knowledge__kav). 

When trying to access a page in your Experience Cloud site which has this page as an authenticated user (Partner Community User or Experience Site User being the best examples) who does not have at least read access on the Knowledge object in the profile or permission set. The component will intermittently fail to load.

If you make a change to the component as the admin user and then save the component, and then login as the Experience Site user, the component will load. 4-5 hours later it will fail to load. 

This can make troubleshooting the issue a real problem. 

This can also occur if your Custom Theme Layout references the Knowledge Object also. 

Example Component:
 
<aura:component controller="CaseController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >

</aura:component>

Example Controller:
public without sharing class CaseController {
     
    @AuraEnabled
    public static List<Knowledge__kav> searchArticles(String dataCategory){
        
        List<Knowledge__kav> knowledgeArticleList = new List<Knowledge__kav>();
        try{
            
            knowledgeArticleList = [select title,Summary,UrlName from Knowledge__kav where PublishStatus = 'Online' limit 6];
            return knowledgeArticleList;
            
        }catch(Exception ex){
            
            return null;
        }
    }
}

 
Lösung
In order to avoid this issue, please ensure that any users accessing a component which queries Knowledge Object (even if they don't use the functions in those controllers) has at least READ access to Knowledge. 

This can be done either on the Profile or with a Permission Set. 

 
Nummer des Knowledge-Artikels

000384125

 
Laden
Salesforce Help | Article