Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Make field required when it is not set to ReadOnly for specific transition

I have a Field called "Domain" - need to make it required when it is not set to ReadOnly.

For specific workflow transition. Am trying to do this using "Field(s) required validator".

Am attaching the Screenshot for the same. Am not knowing if am doing the right way. Please guide me.Screenshot 2022-08-26 105023.jpg

1 answer

1 accepted

3 votes
Answer accepted
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Aug 27, 2022 • edited

Hi @Preeti Yadav

Your approach will not work because the method setReadOnly is only usable in the Behaviour and not in Validators.

For your requirement, why not just add a transition screen? And for that transition screen, you can use the Behaviour to set the field to required and editable. Using this approach, you can use Behaviour to validate to ensure that the value of the field is added.

Below is a sample code for your reference:-

import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript

@BaseScript FieldBehaviours behaviours
def sampleTextField = getFieldById(fieldChanged)

sampleTextField.required = false
sampleTextField.readOnly = true

if (actionName == 'Done') {
sampleTextField.required = true
sampleTextField.readOnly = false

Please note that the sample code provided is not 100% exact to your environment. Hence, you will need to make the required modifications. 

Below is a screenshot of the Behaviour configuration:-


Also, I have included a few test screens for your reference.

1. First, when creating a new issue, no value is added to the Sample Text Field, as shown below:-


2. Once the issue has been created, it will be transitioned to the Done status.


3. Once the Done button is clicked, the Done transition screen appears, and in it, the Sample Text Field is added. Now, the field is editable and is set to required, as shown below:-


4. If I try to close the issue without adding any value to the field in the transition screen, as expected, the validator returns an error message saying that the value for the field is required, as shown below:-


5. Once the value is added for the Sample Text Field on the transition screen, the issue can be transitioned to the Done status. Below you can see that the issue has transitioned, and a value has been added for the Sample Text Field.



I hope this helps to solve your question. :)

Thank you and Kind regards,


Hi @Ram Kumar Aravindakshan _Adaptavist_ 

Thanks for suggesting this approach. Working fine! 

Suggest an answer

Log in or Sign up to answer