Show custom fields and make them readonly at the same time

I do have a custom field type (A) which I can't make readonly in a certain workflow step with ScriptRunner (It's probably not supported).
Let's say I do have the workflow steps Status 1, Status 2, Status 3 

My workaround is to create a new JIRA custom field (B).

  1. Copy the value of the  customfield (A) into (B) during transition from Status 2 to Status 3 
  2. Customfield (A) is visible in Status 1 and Status 2 
  3. Custom field (B) is not visible in Status 1 and Status 2 
  4. Custom field (B) should be shown in Status 3 and defined as readonly.

Problem with Behaviours is that I cant differentiate between Hiding and making a field Readonly for different statuses.

Is there a way with a script to solve the problem?

Regards,

Joerg

 


 

1 answer

1 accepted

1 vote

In a behaviour you can check what workflow step or action you are currently on if you attach a server side script to the initialiser or one of the fields. Please see example #7 here.

You can modify the example to be something like:

if (getActionName() == "Start Progress" || getDestinationStepName() == "Done") { // <7>
    formField.setHidden(false)
    formField.setReadOnly(true)
} else {
    formField.setHidden(true)
}

This should achieve what you want.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

73 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you