You need to sign in to do that
Don't have an account?
Prevent custom lightning component related list from rendering if the user does not have access to the object
Hi and thank you in advance.
I have a lighting component that serves as a custom related list for a custom object, we'll call testObject__c. The lighting component lives on a standard object, Opportuniy. Here is what i am trying to prevent: when a user that has access to the Opporuntity object views an Opportunity record, but they don't have access to the custom object (testObject__c) they get an error on their screen which I have determined is because the Lighting Component related list for the custom object (testObject__c) is still trying to load.
I have added an attribute which gets set based on this:
Boolean userCATMAccess = Schema.sObjectType.testObject__c.isAccessible();
However, even though that check comes back false the Lighting Component related list still tries to render and throws the error.
My question is how do I prevent the Lighting Component related list from trying to render if the user does not have access to the testObject__c but does have access to Opportunity records?
It is an interesting question.
You cannot prevent totally the call to the Lightning component itself but you can close the popup of the quick action (init event) (if it is one here) immediatly as soon as you have got false from the test on Boolean userCATMAccess which works.
It is more a workaround.
Did you use with sharing for your controller?
https://developer.salesforce.com/page/Lightning_Security
No one helps you here because you don't provide any code (nothing). The problem could be an other reason.No code, no help most of the time.
Just one wrong word in your code, all will fail.
Show us your code and we will fix it immediatly probably.