Skip to main content

Uncaught TypeError: Cannot read property ‘setRow’ of undefined while saving the model from JS snippet


I’m creating the new record using the Table component, and saving the model from the Javascript snippet on click of row action button, instead of Skuid’s default save action.

during that snippet execution, i’m gettign the mentioned error, and it’s not going inside the callback function of save.


Snippet for reference…


var quoteLines = skuid.model.getModel(‘QuickQuoteEquipment’);

var quotes = quoteLines.getRows();

var qqIds = ;


var quickQuoteModel = skuid.model.getModel(‘QuickQuoteModel’);

try{

   $.each(quotes, function (i, row){  

      // Only proceed if the row has unsaved changes

      if (quoteLines.isRowChanged(row)) {

            console.log(‘Entering row changed…’);

              console.log(row.Id);

              var qq = row.genesis__Quick_Quote__c;

                console.log(qq);

                if(!qqIds.includes(qq)){

                    qqIds.push(qq);

                }

      }

   });


    //quoteLines.save();

    console.log('qqIds Set = '+qqIds);

    console.log('qqIds Set Lenght= '+qqIds.length);

    if(qqIds.length > 0){

        console.log(‘entering the size loop…’);

        skuid.model.save(


,{callback: function(outcome){

            console.log(‘entering the save function loop…’);

        if (outcome.totalsuccess){

            console.log(‘Success’); 

            $.each(qqIds, function (id, rowId){ 

                        console.log('While calling calculator… rowId = '+rowId);

                        var row1 = skuid.model.getModel(‘QuickQuoteModel’).getRowById(rowId);

                        console.log('row 1 = '+row1.Residual_Value__c);

                    var result = sforce.apex.execute(‘LendingCalculator’,‘DoCalculationForQQ’,

                {   

                

                    quickQuoteId : rowId


                });

   

                if(result != ‘SUCCESS’){

                    alert(result);    

                }

                else{

                    skuid.model.updateData( quickQuoteModel,quoteLines]);

                }

            });            

        }

        else {

            // There was a problem. Let’s see what went wrong.

           console.log(‘Error Happened…’);

            console.log(outcome.insertResults/0]);

         }

    }});

    }

}

catch(err) {

    console.log(‘Error = ‘+err)   ;

}

skuid.$(’.ui-dialog-content’).dialog(‘close’);

Be the first to reply!

Reply