4

We have a community where we would like the external users to view some records that they don't own. We have a list view of records and upon clicking them they should be redirected to the detail view of the record. I have achieved the listing of the records but the detail view is the issue. This is a simple thing to do within Salesforce by using the without sharing apex controller but in communities we need to use lightning components and when I use the without sharing in communities to implement the same behavior I get an Invalid Page error in the detail view. Is this an expected behavior in lightning or is there something I'm missing?

1 Answer 1

6

As far as I can tell you ,its not good to use "without Sharing" ,instead I would explore out of box options to share the records to the user (Sharing rule or role hierarchy) or if out of box do not work then explore apex sharing .

Now there is nothing currently stopping you to not use "without sharing" in Lightning components .I will enable lightning debuger and would open the chrome console and look for issues in the console .

In community builder whenever lightning component throws any exception we just see page is Invalid exception .

Also not using "with sharing" keyword simply means its without sharing so you may omit "without sharing" if that works for you .

8
  • Thanks Mohith..I checked the console but received no error in it.I canoot see any log messages and it seems the page is simply being refused to load. Interestingly enough, When I log in as an admin I'm able to view the record and all the log messages which means the code runs for admin. But it's restricting me to view it as a community user. This made me suspect the access issue. Commented Jun 4, 2016 at 2:51
  • 1
    I would also like to add here that I'm using "e.force:navigateToSObject" for navigating from custom list view component to the custom detail view component page. Can this be the reason that SF is respecting the security settings of the user and overriding the apex? Commented Jun 4, 2016 at 3:00
  • Can you write a class like public class classname{} .Don't use any keyword .Also second comment can be cause for the issue Commented Jun 4, 2016 at 3:04
  • Ok, if the navigateToSobject can be the cause then what could be the alternative for redirection to the next page in the community? Commented Jun 4, 2016 at 3:11
  • you can also use events of lightning components to navigate .developer.salesforce.com/docs/atlas.en-us.lightning.meta/… Commented Jun 4, 2016 at 3:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .