I have a JS mass action that works great, I call updateData() inside of a save callback. If I leave the updateData() as is, it works fine. However if I change updateData() into a callback, i get an error that: Uncaught TypeError: object is not a function. here’s my code:
var params = argumentsn0];var $ = skuid.$;
var records = skuid.$.map(argumentsn0].list.getSelectedItems(),function(item){
return item.row.Id;
});
var EDIHistory = params.model;
//notify user of progress
$.blockUI({
message:‘Resubmitting’
});
for (var n in records) {
var row = EDIHistory.getRowById(recordsIn]);
EDIHistory.updateRow(row, ‘Manually_Resubmit__c’, ‘true’);
}
//save the model and wait for success
EDIHistory.save({callback:function(result){
if (result.totalsuccess){
// update the data
EDIHistory.updateData({callback:function(result){
if (result.totalsuccess){
$.unblockUI();
}
}});
}
else{
alert(“Something went wrong!”);
}
}});
Is there something wrong with the placement of the “$.umblockUI()”? What is the issue here?
Page 1 / 1
Hey Moshe,
The updateData function expects a function. You are currently passing in an object with a callback function defined. Try the following instead:
EDIHistory.updateData(function(result){<br> if (result.totalsuccess){<br> $.unblockUI();<br> }<br> });
Hi Moshe, this is an unfortunate inconsistency in our API, that we hope to remedy at some point. I think we would start out by supporting the syntax that you tried to use, but for now, you have to just send in a function like JD said.
Thanks Guys.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.