Hello,
We define a workflow validator with Scriptrunner, to allow the transition only if a custom field (text field, with Wiki Style Renderer) is not empty.
The Jira expression is:
issue.customfield_10052 != null && issue.customfield_10052.trim().length > 0
The validator is OK when we test it from Scriptrunner Workflow Overview:
The validator works correctly when we transition the issue from a board.
But when we want to transition the issue from the issue view, we get this error:
"errorMessages": [ "Evaluation failed: \"issue.customfield_10052.length > 0\" - operator \">\" is not applicable to types: null and Number" ]
and the error message popup is displayed:
Can you please help me understand why the behaviour is different in both views and how to fix this, so that the validator works wherever the transition is done?
Thanks.
Hi Emilie, this document should give you an overview of the changes Atlassian implemented a couple of months back regarding the usage of the new v3 api to execute these transitions
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
Hopefully this will help you reach your goal!
Thanks
Hi Jorge,
That's it: it works as expected (both on board and issue view) with the RichText constructor from ADF Map.
Thanks a lot!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not sure if i properly understand the problem but error just says that you can not check if null is greater then 0. So if you have null in that field it just fails. I just don't understand when you said that sometime it works - on same issue and same customfield values it works on transitioning from boards and on issue view it fails? it would be interesting but maybe on transitioning issue on boards it is not checking validators?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's it: on a same issue and so the same customfield values:
And it's the same for the validators we base on text customfields.
What we do:
Maybe that's not the correct way to achieve that with the Jira expression, I don't really know as it's OK from the board.
The errors began Jan 29.
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.