Hi Anna,
So you’re saying that if I use skuid.model.save(ArrayOfBothModelsToSaveSimultaneously) it won’t give the invalid ID error?
I’ve run through a test of this and it appears to work!!
var params = arguments[0], $ = skuid.$;
var am = skuid.model.getModel('AccountModel');<br>var cm = skuid.model.getModel('ContactModel');
var models = [];
models.push(am);<br>models.push(cm);
$.when(am.createRow({doAppend: true, additionalConditions: [<br>{field: 'Name', value: 'TEMPVARTESTACCOUNT'}<br>]<br>})).done(function(){<br> var amRow = am.getFirstRow();<br> <br>$.when(cm.createRow({doAppend: true, additionalConditions: [<br> {field: 'LastName', value: 'TEMPVARTESTER'},<br> {field: 'AccountId', value: am.getFieldValue(amRow,'Id',true)}<br> ]<br> })).done(function(){<br> <br> skuid.model.save(models, {rollbackOnAnyError: true,callback: function(result){<br> console.log('SAVE RESULTS:');<br> console.log(result); //Success!!<br> }});<br> });<br>});
It also appears that if I run an action sequence (UI editor) based save on both models simultaneously that is working as well. This is very strange though because I was using an action sequence based save on all models simultaneously before when I first created this forum thread and it was giving me the invalid Id error; now that I try coding it out in my test example it seems to not be having that problem. Very peculiar. It’s been a while since I had this error in my original code and I’ve since reworked it using a different strategy for saving / relating items. I’ll let you know if I can reproduce my original issue as we’re coding our new project up and do some more testing around it, otherwise it appears this strategy works! Thanks!