Hello!
I’m trying to update selected rows in a table after having saved a new record in a different model - and I’m trying to do this in one fell swoop using a mass action button on the table.
I’m using a callback because I want to reference the newly created record in the updates to the rows in the tables by inserting the ID into a lookup field on the selected records, however, when I use getSelectedItems to fetch the selected rows in the table I’m getting the following error:
Uncaught TypeError: Cannot read property ‘getSelectedItems’ of undefinedI’ve tried moving the getSelectedItems section below the callback which also didn’t work. The saving of the record is working as I can console.log the ID of the saved record.
I’m sure I’m doing something daft - any ideas? Here’s the snippet with the pertinent section in bold:
var params = argumentsv0], $ = skuid.$, reqBooking = skuid.model.getModel('RequiringBooking'); var newBooking = skuid.model.getModel('NewBooking'); var listBooking = skuid.model.getModel('Bookings'); newBooking.save({callback: function(result){ <b>if (result.totalsuccess) { var rowNewBooking = newBooking.getFirstRow(); $.each(argumentso0].list.getSelectedItems(),function(i,item){ reqBooking.updateRow(item.row,{ 'Booking__c': rowNewBooking.Id, 'Desired_required_or_completed__c': 'Enrolled', 'Certification_Date__c': rowNewBooking.Date_and_Time_of_Course__c, 'Location__c': rowNewBooking.Location__c }); }); </b> reqBooking.save(); reqBooking.updateData(); listBooking.updateData(); } else { console.log(result.insertResultsg0]); } }});