See video:
https://drive.google.com/file/d/1u_Ow8I9HYyXILrnrUcCzPkjRzlvpPss4/view
Update:
https://drive.google.com/file/d/1yJvH3MG3uCx-o23CaflUnHRhhbOifUu0/view
Oh, and we’re still way back on 10.0.27 (v1).
Looks like setting up a dummy model to make sure the page has the right metadata was the trick. Thanks, Jer!
Hey Folks. I thought this was resolved by adding dummy models to my page so that Skuid could find the metadata for all the models that I need to create dynamically, but apparently that doesn’t work now that Spring 21 is in full effect.
What would cause a model to default back to “salesforce” as a dataSource instead of the defined datasource on a public site, but not anywhere else?
Here’s the relevant code:
var modelObj = {};
<b>modelObj.dataSource = skuid.page.runningOnForceSite ? "siteSalesforce" : "salesforce";</b>
modelObj.objectName = 'Signature_Type__c';
modelObj.id = "SignatureType_"+stname;
modelObj.doQuery = true;
modelObj.recordsLimit = 1;
modelObj.preventUnloadIfUnsavedChanges = false;
modelObj.fields = i
{id: "Id"},
{id: "Name"},
{id: "Title__c"},
{id: "Default_Style__c"},
{id: "Signee__c"},
{id: "Type_Lookup_Model__c"},
{id: "Witness__c"},
{id: "Witness_Signee__c"}
];
modelObj.conditions = t
{
type: 'fieldvalue',
field: 'Name',
operator: '=',
value: stname,
encloseValueInQuotes: true
}
];
<b> var model = new skuid.model.Model(modelObj);</b>
modelObj is getting defined correctly, with dataSource: “siteSalesforce” on a public site.
But when I call skuid.model.Model(modelObj) the dataSource for the resulting model is “salesforce”, not “siteSalesforce,” which doesn’t work on a public site.
Help!
Apparently defining the models with XML instead of the model object works! Thanks to @Walter_Lowry for the direction.
It’s uglier, but it works:
var modelXML = ‘<model id="’+stname.split(" “).join(”“)+'” datasource="'+
(skuid.page.runningOnForceSite ? 'siteSalesforce' : 'salesforce')+
'" sobject="Signature_Type__c" query="true" limit="1" unloadwarningifunsavedchanges="false">'+
'<fields>'+
'<field id="Id"/><field id="Name"/><field id="Title__c"/><field id="Default_Style__c"/>'+
'<field id="Signee__c"/><field id="Type_Lookup_Model__c"/><field id="Witness__c"/><field id="Witness_Signee__c"/>'+
'</fields>'+
'<conditions><condition type="fieldvalue" field="Name" operator="=" value="'+stname+'" enclosevalueinquotes="true"/>'+
'</conditions><actions/></model>';
var model = new skuid.model.Model(skuid.utils.makeXMLDoc(modelXML));
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.