Skip to main content
Nintex Community Menu Bar
Question

Uncaught TypeError: Cannot read property 'setRow' of undefined while saving the model from JS snippe


Forum|alt.badge.img+1

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(
[quoteLines]
,{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’);

Translate
Did this topic help you find an answer to your question?

0 replies

Be the first to reply!

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings