Hey Joel
Here's a start for you - I made this script run on a button field next to the checkbox field (I'm on the freeplan so can't run a script based on a field change).
Change the YOURFIELDID to the ID of the checkbox field an YOURFIELDNAME to the name of the checkbox.
You'll also want to change the "TRUE" and "FALSE" to the icon you want to use.
It's just a start as I believe when you remove the icon from the field name you'll have to check ALL records to see if any other checkbox is set to True and if it is then you want the icon to stay put.
----------------------
const tableId = cursor.activeTableId;
const table = base.getTable(tableId);
let record = await input.recordAsync('Pick a record', table);
// if we have a record
if (record) {
// change the checkbox to either on or off
table.updateRecordAsync(record, {"YOURFIELDID" : ! record.getCellValue("YOURFIELDID") });
// get the field
let field = table.getField("YOURFIELDID");
if(record.getCellValue("YOURFIELDID") == null)
{
myvalue = "TRUE"
}
else
{
myvalue = "FALSE"
} ;
await field.updateNameAsync(("YOURFIELDNAME " + myvalue));
}
Hey Joel
Here's a start for you - I made this script run on a button field next to the checkbox field (I'm on the freeplan so can't run a script based on a field change).
Change the YOURFIELDID to the ID of the checkbox field an YOURFIELDNAME to the name of the checkbox.
You'll also want to change the "TRUE" and "FALSE" to the icon you want to use.
It's just a start as I believe when you remove the icon from the field name you'll have to check ALL records to see if any other checkbox is set to True and if it is then you want the icon to stay put.
----------------------
const tableId = cursor.activeTableId;
const table = base.getTable(tableId);
let record = await input.recordAsync('Pick a record', table);
// if we have a record
if (record) {
// change the checkbox to either on or off
table.updateRecordAsync(record, {"YOURFIELDID" : ! record.getCellValue("YOURFIELDID") });
// get the field
let field = table.getField("YOURFIELDID");
if(record.getCellValue("YOURFIELDID") == null)
{
myvalue = "TRUE"
}
else
{
myvalue = "FALSE"
} ;
await field.updateNameAsync(("YOURFIELDNAME " + myvalue));
}
(I'm on the freeplan so can't run a script based on a field change).
@John1 Note that .updateNameAsync() only works in scripting extension, not automations scripts, so this particular script won't work in an automation anyway.
@Joel_Andrews1
Since you refer to being able to do this with a SWITCH() formula, I'm guessing that you want a formula that will give you an emoji that you can use in the value of the primary field of the record, versus changing the actual field name.
Try something like this ...
IF( {checkbox field name}, "🤖")
Be sure to put the emoji in straight quotes.
Looks like the forum software doesn't like emoji. It turned my emoji into text.
(I'm on the freeplan so can't run a script based on a field change).
@John1 Note that .updateNameAsync() only works in scripting extension, not automations scripts, so this particular script won't work in an automation anyway.
@Joel_Andrews1
Since you refer to being able to do this with a SWITCH() formula, I'm guessing that you want a formula that will give you an emoji that you can use in the value of the primary field of the record, versus changing the actual field name.
Try something like this ...
IF( {checkbox field name}, "🤖")
Be sure to put the emoji in straight quotes.
That's exactly what I was looking for. Thanks!