
Comment Post Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 21, 2021 11:00 PM
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 !
1 Reply 1

Comment Post Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 22, 2021 11:04 AM
Try simplifying your code down:
let record = queryResult.getRecord(recordId[0]);
await table.updateRecordAsync(record, {
"Payment": record.getCellValue("Payment") ? false : true
});
}
Reply
