How to populate a table with records the user can't see?

  • 1
  • Question
  • Updated 3 years ago
  • Answered
We have two custom objects - let's call them "bucket" and "stuff". A bucket can contain zero to N stuff records e.g. there is a lookup relationship from stuff to bucket. Because it is a lookup relationship stuff has it's own _share object. Because of the way stuff is being bucket(ed), users that can see the stuff related to a bucket may not be able to see all of the stuff related to the bucket.

We have a requirement for a bucket Skuid page that has two tabs - a tab that lists the stuff in that bucket that the user has read or read/write permissions on and a tab that lists the stuff that the user does not have permission to read.

To the best of my knowledge I can't use a model to display the list of stuff records the user can't at least read. In a class.method "without sharing" I can get at the unreadable stuff records, but how do I pass them back out to Skuid to be displayed on the page? Or (hopefully) is there an easier way to tackle this?
Photo of Andy Forbes

Andy Forbes

  • 322 Points 250 badge 2x thumb

Posted 4 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Umm..  Skuid is not going to be real helpful if you are trying to get around the salesforce security model.  

Having said that,  I think I understand what you are trying to do.  If a user doesn't have read access to a stuff record,  you still want them to be able to see a few fields,  but not everthing, and certainly not edit.   I don't think that is feasible with standard salesforce security model.  But maybe there are some options. 

- You might create another sObject that poplates the selected fields based on workflow or a trigger.  
- You might also review this tutorial about building models on the fly: http://help.skuidify.com/m/11720/l/228794-dynamic-creation-of-models-and-components-with-javascript
Photo of Andy Forbes

Andy Forbes

  • 322 Points 250 badge 2x thumb
@Rob - Yep, you understand the requirement. I *really* do not want to create and maintain a lightweight mini-mirror of the stuff object. I can fairly easily create an APEX class that runs without sharing and that returns a list of lists containing the data I want to display. Am I overly optimistic to hope that I can call the method and then display the list of lists in a Skuid table? If the answer is "yes, Andy, you are far too optimistic" :-) , other than a model is there a way to get tables (rows, columns) of data from SFDC and display the data on a page?
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Were you able to make this work? I'm curious as I have a similar requirement.
https://community.skuidify.com/skuid/topics/cant-get-all-events-to-show-in-calendar-for-standard-user-unless-view-all-system-permission-is-granted

I, as well, would prefer to not create a mirror object to expose Events that I'd like to show to the user.
Photo of Andy Forbes

Andy Forbes

  • 322 Points 250 badge 2x thumb
@Pat - We ended up not rendering the tab that was supposed to display the data the user was not able to view. I do still need to get this working, though. If you figure it out please post your solution here :-) . 
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
We're likely going to create a mirror object for my requirement.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Andy,  you should be able to use the CreateRow method of our Model API to introduce data returned from your APEX class into a Skuid model.  Look here: 

http://help.skuidify.com/m/11720/l/205447-skuid-model-model
http://help.skuidify.com/m/11720/l/228794-dynamic-creation-of-models-and-components-with-javascript



Good luck.