I’m trying to dynamically build a series of models on external salesforce data sources. What do I need to pass to the model definition to get the model to load properly? Apparently giving skuid the dataSourceTypeName and dataSourceName is not enough. The model isn’t getting the dataSource properly.
Any ideas?
Here’s the relevant code:
var buildModel = function (n) {<br /> var model = new skuid.model.Model();<br /> model.dataSourceTypeName = "salesforce";<br /> model.dataSourceName = n;<br /> model.objectName = "Patient_Case__c";<br /> model.id = n;<br /> model.type = 'aggregate';<br /> model.isAggregate = true;<br /> model.groupByMethod = 'simple';<br /> model.groupByFields = [<br /> {id: "Positive_Pregnancy_Test__c", name: 'testresult'}<br /> ];<br /> model.fields = [<br /> {id: 'Id', name: 'countId', function:'COUNT'},<br /> {id: 'Positive_Pregnancy_Test__c', name: 'testresult', groupable: true}<br /> ];<br /> return model.initialize().register();<br />};<br /><br />$.each(loopArray,function(i,name){<br /> modelsToQuery.push(buildModel(name));<br />});<br />$.when(skuid.model.load(modelsToQuery)).then(function(){<br /> <br /> //The models have no data!<br /> dfd.resolve();<br />});
