# Allow Rules/Formula Involving Rich-Text Fields

**URL:** <https://community.fibery.io/t/allow-rules-formula-involving-rich-text-fields/2108>\
**Category:** Ideas & Features\
**Tags:** formulas, rich-text\
**Created:** [October 6, 2021, 9:00pm UTC](https://community.fibery.io/t/allow-rules-formula-involving-rich-text-fields/2108 "2021-10-06T21:00:47Z")\
**Posts on this page:** 8\
**Page:** 2

<div class="post-metadata">

**Author:** ![Dimitri\_S](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/dimitri_s/32/1683_2.png) [@Dimitri\_S](https://community.fibery.io/u/Dimitri_S)\
**Post date:** [August 5, 2022, 2:49pm UTC](https://community.fibery.io/t/allow-rules-formula-involving-rich-text-fields/2108/21 "2022-08-05T14:49:45Z")

</div>

Throwing my vote in.

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

---

<div class="post-metadata">

**Author:** ![sbradley0](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@sbradley0](https://community.fibery.io/u/sbradley0)\
**Post date:** [August 28, 2022, 1:40pm UTC](https://community.fibery.io/t/allow-rules-formula-involving-rich-text-fields/2108/22 "2022-08-28T13:40:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Dimitri\_S](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/dimitri_s/32/1683_2.png) [@Dimitri\_S](https://community.fibery.io/u/Dimitri_S)\
**Post date:** [May 2, 2023, 6:03pm UTC](https://community.fibery.io/t/allow-rules-formula-involving-rich-text-fields/2108/23 "2023-05-02T18:03:23Z")

</div>

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

```auto
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:”

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [May 2, 2023, 6:11pm UTC](https://community.fibery.io/t/allow-rules-formula-involving-rich-text-fields/2108/24 "2023-05-02T18:11:56Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![Dimitri\_S](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/dimitri_s/32/1683_2.png) [@Dimitri\_S](https://community.fibery.io/u/Dimitri_S)\
**Post date:** [May 2, 2023, 6:34pm UTC](https://community.fibery.io/t/allow-rules-formula-involving-rich-text-fields/2108/25 "2023-05-02T18:34:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [December 12, 2024, 4:59pm UTC](https://community.fibery.io/t/allow-rules-formula-involving-rich-text-fields/2108/26 "2024-12-12T16:59:07Z")

</div>

Just an note to say that it is now possible to detect an empty rich text field without scripting

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/8/8a86139334f945f305b3a3a87a1a6d060622ab4a.png)

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [December 12, 2024, 4:59pm UTC](https://community.fibery.io/t/allow-rules-formula-involving-rich-text-fields/2108/27 "2024-12-12T16:59:23Z")

</div>



---

<div class="post-metadata">

**Author:** ![mdubakov](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/mdubakov/32/10_2.png) [@mdubakov](https://community.fibery.io/u/mdubakov)\
**Post date:** [December 13, 2024, 6:46am UTC](https://community.fibery.io/t/allow-rules-formula-involving-rich-text-fields/2108/28 "2024-12-13T06:46:47Z")

</div>



[Previous page](https://community.fibery.io/t/allow-rules-formula-involving-rich-text-fields/2108.md?page=1)
