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
AbAb 

contents of lwc are not accessible to al profiles

Hello,

Few profiles dont have access to element in LWC are there any elements we can test so all have sale accessbility, please ?
Best Answer chosen by Ab
Jaya Karthik  karnatiJaya Karthik karnati
@sandrine ,

Thanks for confirming all the details , we too faced similar issue in our org ( the LWC page was visible for the profile in UAT but not in prod)

The RCA for our issue is the FLS , one of the field getting used in the LWC didnt have FLS for the user profile , so thats why the whole LWC was not visible.

Once the read only permission is given to the issue field , the page started loading.

Can you kindly cross validate the FLS , if there is no error getting captured either in inspect--> Console or developer console.

Then the last left option would be FLS.

Thanks,
Karthik

All Answers

SwethaSwetha (Salesforce Developers) 
HI Sandrine,
Please check if you need to give access to related Apex class to the concerned profiles.

This can be done in two ways; 
Go to profile -> Enabled Apex class access -> Edit -> Add the Classes and Save

Go to the class -> Click on Security -> Select Profiles and add to enabled profiles -> Save

If this information helps, please mark the answer as best. Thank you
Jaya Karthik  karnatiJaya Karthik karnati
Hi Sandrie,

We cannot control LWC access directly VIA profile, but we can control the access via page layout.

Relevant Link : https://salesforce.stackexchange.com/questions/223696/lightning-component-visibility-based-on-profile ,

Since you are stating that few profiles are not able to access , can you please check at the layout level , if there is any configuration present to control the LWC visibility based on profile.

Hope It helps, if so kindly mark it best answer to close this question. 

Thanks,
Karthik  
AbAb
Hi @jaya Karthik
How can i verify " if there is any configuration present to control the LWC visibility based on profile.", please ?
Jaya Karthik  karnatiJaya Karthik karnati
Hi Sandrine,

For validating any configuration is present or not . Kindly follow the below steps.
  • Open the page in which LWC is configured.  
  • Click on setup --> Edit page 
  • Once the app builder window opens --> click on LWC component
  • On right side of the page you can see component visibility, you need to check whether there are any confirgurations present to hide the LWC based on the profile.
    •  User-added image
Thanks,
Karthik
AbAb
Set component visitibilty is null
Jaya Karthik  karnatiJaya Karthik karnati
Ohh thanks for confirmation sandrine , 

Then other way to debug is , login through the profile from which LWC was not showing ,
  • Open the record.
  • Right click on the page --> click on inspect
  •  check in console if any error is getting printed. 
One more confirmation i would like to know is , there no code present in LWC HTML and JS part right where the layout wont be visible for few profiles.

Thanks,
karthik
AbAb
I have checked things,
- the object and field is visible to the profile in question
- the controller is accessible
- Set component visitibilty is not present

 
AbAb

@Jaya Karthik karnati

I see that the profile has acees to the page in UAT but not in production.
I saw that the fields didn't had visibility to the profile. I added the visibility in fields.
- the controller is accessible
- Set component visitibilty is not present

What are other things to verify 

Jaya Karthik  karnatiJaya Karthik karnati
@sandrine ,

Thanks for confirming all the details , we too faced similar issue in our org ( the LWC page was visible for the profile in UAT but not in prod)

The RCA for our issue is the FLS , one of the field getting used in the LWC didnt have FLS for the user profile , so thats why the whole LWC was not visible.

Once the read only permission is given to the issue field , the page started loading.

Can you kindly cross validate the FLS , if there is no error getting captured either in inspect--> Console or developer console.

Then the last left option would be FLS.

Thanks,
Karthik
This was selected as the best answer