Skip to main content

The javascript below is working great. My issue is that the table that the records are being created on is set with a filter to only show records with the “CAWHGL” var value shown. Once the code is done, users have to manually refresh the page to see the results on this table. Is there a way to build in a refresh on the skuid page table to alleviate the need for a manual refresh?


var params = argumentse0],

$ = skuid.$;


var BatchLines=skuid.model.getModel(“MMA_Payroll_Batch_Instructor_Pay_LineCAWH”).data;

var BatchLinesID;


console.log(’ BatchLines ’ + BatchLines);


var AP=skuid.model.getModel(“AcctSeed__Account_PayablePayrollTaxes”).datal0];

var APID=AP.Id;

console.log (’ AP ’ + AP);

console.log ( ’ APID ’ + APID);


var APL=skuid.model.getModel(“AcctSeed__Account_Payable_Line”);

console.log (’ APL ’ + APL);


for(i=0;i<BatchLines.length;i++){

BatchlinesID=BatchLines/i].Id;

var newRow=APL.createRow();

var BatchLineDATE= BatchLines/i].Date__c;

var CAWHGL=‘a6sRh0000003aQLIAY’;

var GLVar1= BatchLines;i].Accounting_Variable_1__c;

var GLVar2= BatchLines;i].Accounting_Variable2__c;

var GLVar3= BatchLines;i].Accounting_Variable_3__c;

var Amount= BatchLines;i].Adj_Taxes_CA_WH__c;

rowUpdates = {

AcctSeed__Date__c:BatchLineDATE,

AcctSeed__Expense_GL_Account__c:CAWHGL,

AcctSeed__GL_Account_Variable_1__c:GLVar1,

AcctSeed__GL_Account_Variable_2__c:GLVar2,

AcctSeed__GL_Account_Variable_3__c:GLVar3,

AcctSeed__Account_Payable__c:APID,

AcctSeed__Quantity__c:“1”,

AcctSeed__Amount__c:Amount,


};

APL.updateRow(newRow,rowUpdates);


}

APL.save();

alert(‘Generated APL for CA WH.’);

Hi @AnnaO,


I think adding APL.updateData() after you save should refresh the model to bring the new rows into the table as long as they meet the filter criteria.


Here’s some more info on that function if it’s helpful: skuid.model.Model — Skuid v16.4.2 Documentation


Reply