Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

ScriptRunner for Jira Cloud: Field(s) changed validator

Tamir Mubarak July 14, 2023

Hello dear community, 

I'm switching our Jira Server Version to Jira Cloud. On the server version we used ScriptRunner for Validators and Post-Functions.

On the Server version it was easy to create a validator in the workflow, which checks if the value of a defined custom field was changed or not. In the Cloud version I need Jira expressions for this. Unfortunately, I'm not an expert in Jira expression. 
I would really appreciate if someone can help me with this requirement:

As a Jira admin I want to have a validator in the workflow (field changed validator) to make sure, that the value of a custom field (cascading select list) was changed before the transition. 

 

Thanks a lot in advance.

 

Best regards,

Tamir

1 answer

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Champion
July 14, 2023

Hi @Tamir Mubarak

For your requirement, you can use the ScriptRunner Script Validator as shown in the screenshot below:-

image1.png

Once you are in the editor screen as shown in the screenshot below:-image2.png

You will need to enter a condition like this:-

issue.customfield_10114.child.value.length > 0

Please note you will need to change the custom field id according to your environment.

This sample code is also available in the ScriptRurnner for Jira Cloud Documentation.

Below is a screenshot of the complete configuration:-

image3.png

I am also including a couple of test screenshots for your reference:-

1) First I create a new Issue. For now, the value of the Cascading Select List is not set as shown in the screenshot below:-

test1.png

2) I try to transition the issue to In Progress and as expected the validation error is displayed:-

test2.png

 

3) Next, I update the Cascading Select List and select some options for it and try to transition the issue to In Progress. As expected, the transition works successfully as shown in the screenshot below:-

test3.png

I hope this helps to solve your question.

Thank you and Kind regards,

Ram

Tamir Mubarak July 14, 2023

Hello Ram,

thanks for your fast respond. I really appreciate this!
This Jira Expression just checks if the field is empty, right?

My requirement would be an expression that checks, if the values in the custom field has changed. 

Could you also help me with this? 

Thanks in advance and best regards,

Tamir 

Lukasz Grobelny
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 14, 2023

Yes, the one above will check if it's not empty. 

 

Field has been modified Validator <- this one will not do?

Tamir Mubarak July 17, 2023

Hello Lukasz,

"field has been modified Validator" was available in the Server Version for ScriptRunner, but unfortunately not in the Cloud Version. There I have to use Jira Expression and that's where I'm stuck...

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events