I’m working on a javasnippet that updates values on one model based on values from another model in a table using a loop. I believe it should work, but in order to make it work with the right data I need to query the model within the loop. However, I can’t get the updateData() function to work in this snippet. I get an error in the console “Uncaught Model ‘model’ has unsaved changes.” What am I doing wrong? I tried putting a model.save() in front of it, but that didn’t fix the problem. (And also wouldn’t that cause issues with SF?) Any help is much appreciated. Thank you var params = arguments[0]; var step = params.step; var $ = skuid.$; var models = skuid.model.map(); var OppLineItems = models.OppLineItems; var NewSalesOrderItems = models.NewSalesOrderItems; var ShippingLocation = models.ShippingLocation; var rowsToUpdate ={}; var ShipToValue = {}; $.each(NewSalesOrderItems.data, function(){ var ShipToValue = NewSalesOrderItems.getFieldValue(this, ‘Ship_To__c’); var locationCondition = ShippingLocation.getConditionByName(‘Id’); ShippingLocation.setCondition(‘Id’, ShipToValue); ShippingLocation.activateCondition(‘Id’); ShippingLocation.updateData(); var row = ShippingLocation.getFirstRow(); var PackagingNote = ShippingLocation.getFieldValue(row, ‘Packaging_Note__c’); NewSalesOrderItems.updateRow(this, { Packaging_Note__c: PackagingNote}); });
Question
Keep getting error when using updateData() to query model
This topic has been closed for replies.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

