Help

I'm trying to create a form automation that would keep an updated amount of our stock inventory

Topic Labels: Automations
714 0
cancel
Showing results for 
Search instead for 
Did you mean: 
josh_vurnovas
5 - Automation Enthusiast
5 - Automation Enthusiast

For some reason, all of records are being updated when I believe my “if” statement should only have the record the form chose to be updated. What am I doing wrong here?

let table = base.getTable(‘Material Log’);
let view = table.getView(‘Joe Inventory Core’);
let inputConfig = input.config();
let coreName = inputConfig.coreName;
let coreNameString = coreName.toString();
let coreNumAdded = inputConfig.numAdded;
let fieldValue = await view.selectRecordsAsync( {fields: [‘Current Core Inventory’,‘Winstore Code’]});
let currentCoreInventory = 0;
let coreName2 = ‘’;
for (let record of fieldValue.records)
{
coreName2 = record.getCellValue(‘Winstore Code’);
if(coreName2 = coreNameString)
{
currentCoreInventory = record.getCellValue(‘Current Core Inventory’);
await table.updateRecordAsync(record, {‘Current Core Inventory’: currentCoreInventory + coreNumAdded,});
}
}

0 Replies 0