One model's data replaced with another model's data despite distinct names!

Terrible and strange problem.

Why would the data from one model be replacing the data from a distinct model when i attempt a save?

I’ve only been able to reproduce this issue with these two models, but I’ve had users report the ‘disappearing name’ in other circumstances as well. 

If it helps, here’s the snippet behind that save button:

'saveAllSnippet': function () {<br> var modelsToSave = [],<br> modelsToExclude = ['AddTests','ProcessLog','ChangeTracker','ShowTabs','UI_Model','DefaultTo','ChartAudit'],<br> dfd = new $.Deferred();<br> $.each(, function(){<br> if (this.hasChanged &amp;&amp; (modelsToExclude.indexOf( === -1) &amp;&amp; this.preventUnloadIfUnsavedChanges) {<br> modelsToSave.push(this);<br> }<br> });<br> $.when(<br> .done(function(result){<br> console.log('All Models Saved.');<br> dfd.resolve(result);<br> })<br> .fail(function(result){<br> console.log('All Model Save Failed.');<br> dfd.reject(result);<br> });<br> return dfd.promise();<br>},

Did you try saving without using the snippet to see what happens?

Good idea, Pat.
When I save the ReturnHQInteraction model separately, it works as expected.

In fact, when I include both models in a manual save (in any order), it seems to work just fine:[skuid.$M('ReturnHQInteraction'),skuid.$M('Interaction')])<br>[skuid.$M('Interaction'),skuid.$M('ReturnHQInteraction')]) 

^^^those both work fine.

If I run a basic version of the same saveAllSnippet in the console it works fine:

var $=skuid.$, modelsToSave = [], modelsToExclude = ['AddTests','ProcessLog','ChangeTracker','ShowTabs','UI_Model','DefaultTo','ChartAudit'];<br>$.each(, function(){<br>if (this.hasChanged &amp;&amp; (modelsToExclude.indexOf( === -1) &amp;&amp; this.preventUnloadIfUnsavedChanges) {<br>modelsToSave.push(this);<br>}<br>});<br>$.when(<br>.done(function(result){<br>console.log('All Models Saved.');<br>})<br>.fail(function(result){<br>console.log('All Model Save Failed.');<br>});

I’d step through the code in your snippet one line at a time and inspect after each.

Ok, I was wrong about my last two posts. it looks like things are consistently going wrong as described in the OP when there are changes in both models and they are saved in the same call.

The only field that is usually changed in the parent page Interaction model is a ui-only field, if that matters?

I’ve had a similar issue with ui only field. Making it read-only fixes the issue for me.

If I make a ui-only field read only, I can still update it with javascript, right?


Ok, skuid. I have a valid workaround, but it would be nice to know if this is on your radar to fix at some point?

When a model has changes only to ui-only fields and is saved in the same action as another model with real database changes, the data from the second model is replacing the data in the first.