For some reason when I do it with the snippet above and use my custom object. It saves, but the message and page fields don’t save. I modified it to use the my field api names and made the page field a lookup to page id instead of the name of the page.
I checked permissions on the fields and its all allowed. And if I add the model declarativly it works, but when I try to create the model through a snippet it doesn’t save any of the field values. Here’s my slightly modified code.
(function(skuid){
skuid.$(document.body).one(‘pageload’,function(){
var LOG_OBJECT = “Skuid_Page_Error__c”;
var MSG_FIELD = “Message__c”;
var PAGE_NAME_FIELD = “Page__c”;
var logsModel = new skuid.model.Model({
dataSource: skuid.dataSource.get(“salesforce”),
objectName: LOG_OBJECT,
fields: [
{ id: “Id” },
{ id: MSG_FIELD },
{ id: PAGE_NAME_FIELD }
],
conditions: [
{ field: PAGE_NAME_FIELD, value: skuid.page.id }
],
doQuery: false,
});
logsModel.initialize();
// Poll every 5 seconds to check for problems
var INTERVAL_FREQUENCY_IN_SECONDS = 5;
logsModel.load().then(function() {
setInterval(function(){
var problems = skuid.page.getAllProblems();
// If we have net-new problems since we last checked,
// wipe out our current problems model and replace its contents
if (problems.length) {
problems.forEach(function(problem) {
var logRow = logsModel.createRow();
logsModel.updateRow(logRow, MSG_FIELD, problem.message);
});
logsModel.save().then(function(saveResult) {
// If everything is saved successfully, clear out problems list
if (saveResult.totalsuccess) {
var pageComponents = skuid.component.getByType(“skuidpage”);
if (pageComponents.length) {
if (pageComponents[0] && pageComponents[0].removeProblems) {
pageComponents[0].removeProblems();
}
}
}
// Otherwise, empty the logs model so we will try to save again later
logsModel.emptyData();
});
}
}, INTERVAL_FREQUENCY_IN_SECONDS * 1000);
});
});
})(skuid);
and field api names
any idea what would be causing this?