Skip to main content
Nintex Community Menu Bar

Building on the case outlined in a previous post, I have a page showing details of object/model “A”. I want users to see a table below that represents a junction object between object “A” and object “B”. The record being linked to in object “B” is the same for all of the records in the table, and I can retrieve It’s ID from existing models on the page. Since the object “B” record is implied, I don’t want to users to have to select it, but I do need the system to be able to populate that field upon save of a new record in the table. Seems like I need a snippet for saving that can set this value on any new records then save the model. How would I identify and loop through the new records to set the value?

Hi Peter, To loop over all records in a model, whether new or not, you need a reference to the model. You do this by using the following code.


var mymodel = skuid.model.getModel('ModelName'); 

Once you have a reference to the model, you can loop over and update the rows in it with the following code. Since jQuery comes with skuid, we can leverage it.


$.each(mymodel.getRows(),function(){ mymodel.updateRow(this,'FieldName__c','UpdateValue'); }); 

Once you’re done updating the rows, you can save the model.


mymodel.save();