I’ve been trying to play around with the scripting base.
I’m very green in JS - so green that I just made it out of the codecademy foundations.
I’m trying to make something very basic.
I want my script to copy value in Field A if there is no value in Field B.
I’ve been banging my head against the wall for a few hours while trying to find help in the examples. But can’t get anything to work. Wondering if there is someone in here that can check my script and point me in the right direction?
let table = base.getTable("Test table");
let fromField = table.getField("fromField");
let toField = table.getField("destinationField");
let result = await table.selectRecordsAsync();
for (let record of result.records) {
let originalValue = record.getCellValue(fromField);
//console.log(originalValue)
if(record.getCellValue(toField)!==null){
table.updateRecordAsync(record, {
fromField: originalValue,
tofield: originalValue
}
}else{
continue
}
}
