We are using JMWE validators to validate different field conditions on certain transitions.
Issue:
We have a validation that checks if a text field (rich text) is empty. When the field is empty, the transition is cancelled and a notification is displayed.
This works correctly initially. However, the problem occurs when we fill the field with content and then delete all the content (leaving it empty) - the JMWE validator seems to interpret this as a non-empty field, even though it appears empty.
Testing:
We tested this with Jira's native field validator, and that validation correctly detects when the field is empty after content deletion. However, we need to use the JMWE validation because we only want to validate issues that meet certain conditions (functionality not available in Jira's native validator).
Question:
Has anyone experienced this issue with JMWE validators and rich text fields? Is there a workaround or specific configuration needed to properly detect when a rich text field is truly empty after content has been deleted?
Any help would be appreciated!
Rich text fields in Jira use the Atlassian Document Format (ADF) to store their content. You can create a Jira expression to check whether the field is empty by examining the field’s value in two scenarios:
When the field has never been set.
When the field once had content, but it was later cleared.
Here’s an example of how the JSON structure appears when a field’s value has been cleared after being set:
Whereas the field value is null if never set after issue creation.
Thus, using a Jira expression to evaluate if the field has a value or not would look something like,
issue.customfield_xyz != null && issue.customfield_xyz.content.length > 0
@Asier Vadillo As Marc pointed out, the above condition will only work for Jira rich text custom fields. It will not work for description or few other system field and would require a bit of tuning to accommodate those fields.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Akash Singh ,
I just found the same thing but thanks for the reply! Really helpful.
You picked my interest, how would it work with the description field??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Asier Vadillo For description you would need to use below Jira expression,
issue.description.plainText.length > 0
If you were satisfied with my answer, I would request you to kindly mark my answer as accepted. It helps others in the community find the solution more easily.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian has modified the handling of Rich Text fields (for example, Description and Comments) in Jira expressions, impacting JMWE Validators.
Any JMWE Validators that use Rich Text fields will fail
See; https://appfire.atlassian.net/wiki/spaces/JMWEC/pages/465242916/User+Validator
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi @Marc - Devoteam 
Thanks for the reply!
I have found a workaround, once a jira rich text field is populated it generates a Json as metadata even if the field is then emptied. You must ensure that customfield_19293.content != [ ] if you want to use JMWE to validate that it is not empty.
Nevertheless, the article provided is quite handful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
 
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.