Other ways to access SF data from SKUID other than using Models

  • 2
  • Question
  • Updated 3 years ago
  • Answered
  • (Edited)
When SKUID accesses Salesforce data it does so "With Sharing" to respect security permissions etc.. This is usually what I want however there are times where I would really like to feed data to SKUID from a controller or controller extension that may not respect sharing permissions or might not represent an sObject.

For example perhaps I want to write a wrapper class or I want to create my own class in APEX and then display that data within the SKUID UI.

What are some of the options to do this?

My guess is at minimum it will involve writing a custom APEX extension (assuming that SKUID will allow interaction with non-SKUID Apex)

My second guess is perhaps the data is stored in clientside memory in a specific predictable way and I might be able to use a Javascript query to a custom controller of mine via a script and then populate the same memory structure that SKUID uses to leverage that to display the results via standard SKUID components.

My third guess is that I would have to write my own component which runs its own remote query via Javascript to a Global apex class and then handle the returned result without incorporating any of the SKUID magic. (I'm hoping there is some way to leverage the SKUID elements even if it does involve custom work)

Thoughts?
Photo of Joseph Ucuzoglu

Joseph Ucuzoglu

  • 1,074 Points 1k badge 2x thumb

Posted 3 years ago

  • 2
Photo of Jarrod Hinson

Jarrod Hinson

  • 2,310 Points 2k badge 2x thumb
I am actually trying to do the same thing. I am looking to create Models in Skuid for use that do not correlate directly to a SObject. I am trying to go the route of using Angular.js and use Javascript remoting along with external webservices and internal. It would be nice to have some concept of "ViewModels" in SKUID to supplement SObject Models.


If you get anywhere on this I would be excited to see your progress.

https://community.skuidify.com/skuid/topics/integrating-angular-js-with-skuid
Photo of Joseph Ucuzoglu

Joseph Ucuzoglu

  • 1,074 Points 1k badge 2x thumb
In one of my other posts I got a great bit of information showing how to access label information dynamically which hints at the way the information is stored in memory

{{$Model.MyModel.data.0.DASH__r.Var01_Label__c}}

It makes me wonder if we couldn't access this hierarchy and add an additional model into the mix and structure it the same way SKUID does.
Photo of Moshe Karmel

Moshe Karmel, Champion

  • 8,646 Points 5k badge 2x thumb

There is a great API that I have discovered available in every skuid page. Try using sforce.connection.query. You can use it like so:

sforce.connection.query('Select Id From Account Limit 20');

it's a great way to get salesforce data into a skuid snippet. It returns an array of records with the result of the query.

Photo of Joseph Ucuzoglu

Joseph Ucuzoglu

  • 1,074 Points 1k badge 2x thumb
Do you know if that query runs with or without sharing permissions? In some cases I would love to access data that normally would not be available using the With Sharing APEX option.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
I think you guys may be interested in this conversation.  No answers - just pointers. 

https://community.skuidify.com/skuid/topics/how-to-populate-a-table-with-records-the-user-cant-see
Photo of Joseph Ucuzoglu

Joseph Ucuzoglu

  • 1,074 Points 1k badge 2x thumb
This looks very promising, thank you.
Photo of Joseph Ucuzoglu

Joseph Ucuzoglu

  • 1,074 Points 1k badge 2x thumb
Hi Rob, so based on that conversation you listed I see the following:

1) The ability to dynamically create a model (and use SKUID to populate it via standard functions in the API ) - http://help.skuidify.com/m/11720/l/22...

and

2) An model API which could allow me to add new lines to a model using a JSON string - http://help.skuidify.com/m/11720/l/20...

If I am understanding the potential here in a situation where a license does not have access to an object for example is that I could dynamically create/query the object. Get back a table with 0 rows and then populate that table with data I retrieve myself and place into the correct JSON format.

Does that seem possible or am I off?
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Joseph - this does seem plausible.
Photo of Jarrod Hinson

Jarrod Hinson

  • 2,310 Points 2k badge 2x thumb
but we would have to "Stash" the data from this external/other source into fields that exist in the Object for the dummy model?

ex. If we had 2 fields in some non-SF data source, called This and That. The Model we use to store this data would have to have data mapping to map This ==> Model.FieldName and That ==> Model.FieldName2.