speed of skuid.sfdc.search() vs. dynamic model .initialize().register().load()

  • 1
  • Question
  • Updated 2 years ago
  • Answered
I need to dynamically (with Javascript) get the value of a single field from an object.

What's the most economical way to accomplish that?

I can use skuid.sfdc.search to return the row, or I can dynamically build a skuid model and query it. My assumption is that the former would be faster (less overhead?). Can anyone confirm or deny?

Here's my search function. the variable 'code' that I'm using as the search term contains the value of the "Optimize_Code__c" field, which is unique for each row in the object.
var getNavVisibility = function(){
            var dfd = new $.Deferred();
                query: code,
                searching: "ALL FIELDS",
                returning: [{"objectName": "Navigation_Menu_Set__c", "fields": ["Id", "Name", "Optimize_Code__c", "Profile_Visibility__c"]}]
                var records = searchResult.results.length && searchResult.results[0].records;
                if (records && records.length){
                } else {
                console.error('Search failed: ' + searchResult.error);
                console.log('Raw SOSL generated: ' + searchResult.sosl);
                console.log('Original search request');
            return dfd.promise();
Photo of Matt Sones

Matt Sones, Champion

  • 32,106 Points 20k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 53,702 Points 50k badge 2x thumb
The dynamic model load would be faster because you can limit to just a specific row with a model condition --- as long as you know the id of the row you want. This should return really fast because it's using a database index.
Photo of Matt Sones

Matt Sones, Champion

  • 32,106 Points 20k badge 2x thumb
Good to know! Thanks.