Using Inline HTML Field Type
To set the color of a field value based on a condition, you can utilize the inline HTML field type. This field type allows you to input HTML code directly into the field, giving you flexibility in customizing the appearance of the field value.
Setting the Condition in Default Value Field
Once you’ve set the field type as inline HTML, you can specify the condition for changing the color in the default value field. This condition can be based on the value of the field itself or on data retrieved from other fields in the form using formulas.
Example Scenario
Let’s consider an example scenario where you want to highlight overdue invoices in red color on a sales order form. Here’s how you can achieve this:
- Create an Inline HTML Field: Add a custom field of type “Inline HTML” to your sales order form.
- Set the Condition in Default Value Field: In the default value field of the inline HTML field, specify the condition for highlighting overdue invoices. For instance, you could use a formula to check if the invoice is overdue based on the due date and the current date.
- Apply Color Styling: Within the HTML code, apply the desired color styling (e.g.,
<span style="color: red;">{{fieldValue}}</span>) to change the color of the field value when the condition is met. - Save and Preview: Save your changes and preview the sales order form to ensure that the field value color changes as expected when the condition is satisfied.