Aug 08, 2024 06:19 AM
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.
```
Maybe it's not possible right now?
Thank you!
Solved! Go to Solution.
Aug 08, 2024 11:05 PM
Aug 08, 2024 12:55 PM
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.
Aug 08, 2024 01:27 PM
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.
Aug 08, 2024 10:31 PM
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.
👍
Aug 08, 2024 10:59 PM
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 🙏
Aug 08, 2024 11:05 PM