How to unlock the Sprint Field?

Tayyab Bashir Community Champion Jul 12, 2016

Hi, 
I want to make Sprint field mandatory for one of my projects, and I don't want to create a separate workflow for it.
So what I did was create a new field configuration and field config scheme and associated them to that project.

However, the problem is that the field I want to make required is 'Locked' and I can't edit it?

Can anyone help me out with how to unlock or make this field required? 

Many thanks in advance,
Tayyab 

1 answer

1 accepted

1 votes

Don't do it with unlocking - the field is locked for a good reason and even if you unlocked it, changed it and re-locked it, you could cause yourself all sorts of problems.

A better option would be to simply use a validator in a new workflow.  I know you've said you don't want to do it that way, but the unlocking option is a vastly worse way to do it.

(Oh, and if you write a validator that says "if project != X" then exit true" on the first line before checking the sprint value, you don't need separate workflows)

Tayyab Bashir Community Champion Jul 13, 2016

I found this document on how to unlocking the custom fields: https://confluence.atlassian.com/jirakb/how-to-unlock-a-locked-field-779158866.html


But the problem is that these fields are locked again once the JIRA is started again. 

Could you please elaborate on the third thing you said about writing a validator? 
Can I add a condition like this on the workflow? Or are you suggesting to write a separate module?  

That's one of the reasons I told you not to unlock the field - it is locked for a reason and you really should not do that.  Unlocking fields is for correcting errors, it's absolutely NOT for what you are trying to do here.

Validators and Conditions are different things, but have some similarities.  You can use almost the same code for them as they ask a simple question - "does the data match X".  If it does then they return a success, if it does not, then they return a fail.

A condition that fails prevents a transition appearing for the user.  They can't start a transition, it won't be offered to them.

A validator kicks in when a user tries to commit a transition.  If it fails the test, it returns the user to the previous screen (where they clicked the commit) and (ideally) tells them why it failed.

Now, there are already validators available that can check the sprint field (in the JIRA Suite Utilities add-on for example), but they are plain "check field is filled" validators.  If you want projects or issues to do different validations, you will need to use different workflows (e.g. in project ABC, you want the Sprint field optional for Bugs, and mandatory for moving Stories to "in progress", you will need two workflows.  The bug workflow will need no validators, but the story workflow will need them added)

If you don't want to have multiple workflows, you will need to write some code.  A validator module is not hard to write, although I'd use the Script runner to avoid having to do any add-on work at all.  You can take the simple "check if field filled" code and wrap a "if project/issuetype = X, Y or Z" block of logic around it.

Tayyab Bashir Community Champion Jul 14, 2016

Okay thank you for the suggestions Nic. 

I think the most easiest way would be to add a behavior using Behaviors plugin and map it to a single project. this way only one project gets selected and you can chose which fields you want to make it appear required on.

Do you know anything about why are these fields locked in the first place?  

Behaviours would work too, saves you writing all the code.

The fields are locked because you are not supposed to be doing things like that with them, and the lock prevents bad configuration being done to fields you shouldn't mess with.

Doing this with a behaviour or a validator is not a problem because it doesn't directly affect the underlying data

(Although it does make it a right royal pain for the users if you can't create issues without a sprint, and breaks the whole principle of planning and scrum, but that's a different question)

Suggest an answer

Log in or Join to answer
Community showcase
Teodora [Botron]
Published Thursday in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

559 views 2 15
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot