I have the following snippet that executes without errors but doesn’t actually save the records. It’s being called from a mass edit rows button. The records are displayed in a table and I can edit the records and they save correctly. They do not save when this code executes.
This is all happening on the 2nd page of a wizard, if that matters.
I can see the value I want being changed while the code is executing through alerts or through the console, but the record changes are never saved to the database.
Salesforce is the data source. The list of selecteditems is coming from the DeliverableActivities model. All I’m trying to do is update the value of a lookup field on the rows that are selected in a table bound to the model. I retrieved the value on the first step of the wizard and stored it in a UI only data model called Variables. I read that there were some issues with UI fields, so I took the value from the Variable and set it to a string variable to see if that would work. It didn’t, but that code is still there.
I believe I’m calling updateRow incorrectly or the save method incorrectly, but I don’t get any errors.
Any help is greatly appreciated.
var params = arguments[0], $ = skuid.$,
list = arguments[0].list,
selectedItems = list.getSelectedItems();
var models = skuid.model.map();
var Variables = models.Variables;
var da = models.DeliverableActivities;
var vRow = Variables.getFirstRow();
var invoiceID = vRow.Opportunity_Invoice_ID + ‘’;
$.each( selectedItems,
function( i, item )
{
var row = item.row;
try {
da.updateRow(row, { Opportunity_Invoice__c : invoiceID});
} catch(e) {
window.alert(e + ‘’);
}
}
);
skuid.model.save([da], {callback: function(result) {
if (result.totalsuccess) {
//window.alert(‘models saved’);
try {
skuid.model.updateData([da]);
} catch (e) {
window.alert(e);
}
}
}});
Question
Syntax Help Needed - Can't get changes to a model to save using JavaScript

Translate
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.