Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

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

Topic Labels: Automations
161 0
cancel
Showing results for 
Search instead for 
Did you mean: 

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