Allow Rules/Formula Involving Rich-Text Fields

Throwing my vote in.

Really would like to have the IsEmpty() formula work on Rich Text fields.

2 Likes

I’d also like to have IsEmpty() work on Rich Text fields.

At the same time, based on a quick read-through it appears that though for a lot of people the story is “As a Fibery user, I need to be able to see at a glance if a Rich Text field has content or not so that I can quickly determine where information is missing”… so maybe the cheap and cheerful approach is to have that document icon that displays in the field be different if there’s content vs not for now, if building out rich formula / sort / filter functionality is too big a job to roll out easily for this type of field.

Just thinking out loud.

8 Likes

Here is the code I use as a workaround to do validation for empty rich-text fields

Setup:

  1. Create a Checkbox field, ex: “Has RText”
    2. Create an automation rule When > On Schedule, every one hour Then run script:
  2. Create an automation rule When > rich-text field or Checkbox field updated, Then run script:

Code:
Replace RText One with the name of your rich-text field
Replace Has RText One Two with the name of the Checkbox validation field

const fibery = context.getService('fibery');
for (const entity of args.currentEntities) {
    // get the contents of a specific rich text field
    const entityWithFields = await fibery.getEntityById(entity.type, entity.id, ['Some RText']);
    const rtext = await fibery.getDocumentContent(entityWithFields['Some RText'].secret, 'md');
    // get the flagging field
    const hasRichText = entity['Has RText']

    if (rtext && !hasRichText) {
        // set Has RText flag if not already set 
        await fibery.updateEntity(entity.type, entity.id, {
            'Has RText': true,
        });
    } else if (!rtext && hasRichText) {
        // clear Has RText flag if no description
        await fibery.updateEntity(entity.type, entity.id, {
            'Has RText': false,
        });
    }
}

If you get stuck on any part of this code just copy paste it into ChatGPT or Bing Chat and say “Please comment every line of this code:”

Looks good. I should add that it’s now possible to trigger on updates to rich text fields, so you could use a combined Create/Update trigger instead of a scheduled trigger :slightly_smiling_face:

1 Like

Nice, this is a lot better. I have it checking for updates of both the rich text fields as well as the Checkbox field (to correct any incorrect checks). Looks like it updates the Checkbox/validation field after about 10 seconds