Changes affecting workflow validators and post functions on the new issue transition experience

Hey everyone,

In my previous post, we announced the early access program to the new issue transition experience. Akin to the old experience, the new issue transition experience also supports variants of RichText fields such as the Description and Custom Paragraph (multiline text) fields. However, the new experience employs the REST v3 API for Issue Submit utilizing the ADF format, compared to the REST v2 API for Issue Submit utilizing Plain String format based on Wiki Markup. As a result of these format alterations, workflow validators and post functions relying on RichText fields are incapable of parsing the text from the ADF representation, leading to validation failures. Consequently, users may encounter difficulties in transitioning issues.

1. Example of a workflow validator failure

Script

issue.customfield_10043.replace("\n", "---") == "hello---hello"

Below is an example of the workflow error when reproducing this issue.

image-20240425-082256.png

The error message below will display on the transition screen.

image-20240425-142319.png

2. Example of a post function failure

Script

issue.fields.customfield_10033.replaceAll("\n", "---") == "hello---hello"

Below is an example of the workflow error when reproducing this issue.

Screenshot 2024-06-06 at 1.35.58 PM.png

 

Mitigation

To ensure that existing validators and post functions based on applications like ScriptRunner and JMWE for the transition workflow continue working on the new experience, you’ll need to update the scripts with the RichText constructor from ADF Map.

1. Example of a functional solution for workflow validator

let plainTextValue = value => typeof value == 'Map' ? new RichText(value).plainText : value ;
plainTextValue(issue.customfield_10043).replace('\n', '---') == "hello---hello"

You can update and test the above script.

image-20240425-082211.png

2. Example of a functional solution for post functions

Object value = issue.fields.customfield_10033
String plainTextValue = value instanceof LinkedHashMap ? value.get("content").get(0).get("content").get(0).get("text") : value ;
plainTextValue.replaceAll("\n","---") == "hello---hello"

You can update and test the above script.

Screenshot 2024-06-06 at 2.00.46 PM.png


Post the changes made, save the runner, and you should be able to execute the transition successfully. To test this on the new experience, you can request access to join the early access program and reference this post.

This notice is similar to the one for the issue create experience from a while back. You can also view the related changelog on the Jira Cloud platform Developer portal. If you have any questions, please comment on this post or raise a support ticket.

Thanks as always,
Arbaaz Gowher
Product Manager, Jira

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events