Hello guys,
I have a field that tracks the latest payment for a user based on a checkbox.
So basically every time i have a new payment, i’d like to ckeck the checkbox “payment” (if unchecked before). Otherwise, i’d like to uncheck then check it.
But the following code doesn’t do any update when the checkbox was already checked.
How can i make sure these two lines get executed ?
let record = queryResult.getRecord(recordId[0]);
//Uncheck the box if it was checked
if(record.getCellValue("Payment")){
await table.updateRecordAsync(recordId[0], {
"Payment": false
});
}
//Now recheck the box (or simply check it if it wasn't)
await table.updateRecordAsync(recordId[0], {
"Payment": true
});
Thanks for the help !