Forums

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

Making a field readable after a particular status only using groovy

Priyanka Karguppikar January 17, 2019

Hello,

I need to make a field readable only after it passes a particular status. For example, if there is a status called "A" then a custom field "ABC" should be readable after it transits from the status "A" till the workflow is closed. It should also be readable only on the edit screen

Kindly help me with a post function groovy script also let me know if this is feasible.

1 answer

1 accepted

0 votes
Answer accepted
Tarun Sapra
Community Champion
January 17, 2019

Hello @Priyanka Karguppikar

To make a field read-only you would need to use Behaviour module of the script runner plugin.

In the "initializer" section of the behaviour you can add the condition to make the field read-only for certain statuses. 

Plenty of samples here

https://scriptrunner.adaptavist.com/latest/jira/behaviours-overview.html

API here

https://scriptrunner.adaptavist.com/latest/jira/behaviours-api-quickref.html

Priyanka Karguppikar January 17, 2019

Hello @Tarun Sapra,

 

In the behaviour, an entire workflow is chosen. I want something which contains a specific status in the workflow. For example, after a status "a", I want two custom fields to be readable only. But before that status they are editable. Moreover, even if I write a behaviour script, This will only run if the status has a screen on it. For the status "a" there is no screen. I want to know if this can be done through a script even if there is no screen on the status and I also want to know if the field will be readable only the edit screen also. 

Please help.

Tarun Sapra
Community Champion
January 18, 2019

Hello @Priyanka Karguppikar

You will have to add the custom fields on the edit screen as you want them to be read-only only after certain status and not for all statuses. In this case you can write a script in behaviour in which make the field in read-only mode for a group of statuses that come after the status "a". You can add that script in the initializer function of the behaviour module. 

Suggest an answer

Log in or Sign up to answer