Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

Re: Creating checkbox in rich text field via scripting

Solved
Jump to Solution
3982 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Martin_Malinda
6 - Interface Innovator
6 - Interface Innovator

Hello!

If I want to add a checkbox to a rich text field I simply type [] and checkbox appears.

But the same does not seems to work over scripting. I tried all kinds of combinations of `[] ` and `- [ ] ` and so on with no success.

```

let formattedInstructions = instructions.map(instruction => `- [ ] ${instruction}`).join('\n');
```

Maybe it's not possible right now?

Thank you!

1 Solution

Accepted Solutions
dilipborad
9 - Sun
9 - Sun

Hello @Martin_Malinda 
This has already been tested on my side.

dilipborad_0-1723183524108.png

👍

 

See Solution in Thread

5 Replies 5
Saravanan_009
8 - Airtable Astronomer
8 - Airtable Astronomer

As of now, Airtable's rich text field does not support rendering checkboxes through scripting or Markdown-like syntax (e.g., [], - [ ]). The checkboxes that appear when typing directly into a rich text field are part of the WYSIWYG (What You See Is What You Get) editor functionality and aren't replicated when using scripts or formulas.

Martin_Malinda
6 - Interface Innovator
6 - Interface Innovator

Thanks @Saravanan_009, good to have this confirmed. Seems like two different markdown implementations are at play here - one on the backend, another on the client. Good to keep this in mind.

Hello @Martin_Malinda 
I've already implemented that. It works with a checklist.

Use automation script and then strictly follow spacing and format then it works perfectly fine.
See this specific example I've created for strings and arrays.

let inputConfig = input.config();
let recId = inputConfig.recId;
// Uncomment this and fetch record using this and transform the data string
//let table = base.getTable("Your Table Name");
//let record = await table.selectRecordAsync(recId);
//console.log(record);
let testmode = "string"; // Change this based on your mode
let checklistArray = [{ value: "Check 1", "status": false }, { value: "Check 2", "status": false },
{ value: "Check 3 Checked", "status": true }];
let checklistString = `[ ] Check 1\n[ ] Check 2\n[X] Check 3\n[ ] Check 4`;
if (record) {
    let fields = [];
    if (testmode == "array") {
        checklistString = "";
        for (let item of checklistArray) {
            if (!item.status) {
                checklistString += `[ ] ${item.value} \n`;
            } else {
                checklistString += `[X] ${item.value} \n`;
            }
        }
    }
    fields["Text CheckBoxes"] = checklistString
    // @ts-ignore
    let updateRecord = await table.updateRecordAsync(recId, fields);
    //console.log(updateRecord);
}

I've also tested this it working fine for me.
Come up with your implementation if you still have issues.

👍

Martin_Malinda
6 - Interface Innovator
6 - Interface Innovator

Ahh, this is good to hear, thanks @dilipborad! I tried different formats with no success, but I'll try your example and make sure the spacing is correct 🙏

dilipborad
9 - Sun
9 - Sun

Hello @Martin_Malinda 
This has already been tested on my side.

dilipborad_0-1723183524108.png

👍