Hi There,
I am currently administrating a JIRA project. and i have added several cutome fields. and now there is a require for restricting editing on certain fields during the lifecycle of an issue, or in another word, once some of the custom fields have been created, they should be disabled from editing for all users.
I am thinking there would be two way of doing these,
Could you guys suggest a solution or workaround doing this?
Thanks in advance.
Liwei
Hang on, there's a whole lot of totally unneccesary code being thrown around here.
Peter's original answer is correct, as is Henning's follow up.
Put the field on the CREATE and VIEW screens. Do not put it on the EDIT screen.
The user can then add data to the field when it is created. They will not be able to change it again. Click-to-edit is disabled for fields that are not on the edit screen. If you need to change it later in the process, you can put it on a transition screen.
But the fields still needs to be viewed during the flow, and with my understanding of JIRA, if the certain fields can be viewed, it also means the fields can be modified.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What do you mean with "during the flow"? If a field is editable on the view screen depends on if the field is on the edit screen.
If you add the field to a transition screen it's editable in this transition (independend from the view/edit editability). A transition could be "protected" by a condition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Liwei,
If the fields are only viewable on the view screen (the screen associated with the view issue action in your Screen Scheme) and not on any other screen (except the screen associated with the Create issue action in your screen scheme) they can not be edited.
Best regards,
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The field will still be editable in batch edit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think the issue with this solution is that it means the fields are never editable. Is there a way to have an edit screen but make it no longer accessible after a certain point in a workflow?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No.
You can use workflow properties to block all edits when in a status, but not field edits. The way to handle what you're asking for is to move edit into the workflow, as mentioned above.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for answering. I'm sorry - I'm not clear on what you mean by 'move edit into the workflow'. did read over the 'above' a few times! I want everything to be editable at any time the ticket is viewed, right up until the issue is transitioned to 'archive' status - whereupon, I guess ideally I would like the 'Edit' option to simply disappear when viewing the ticket.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can edit a field in two ways basically.
If you have it on the "edit" screen, then it's editable when editing the issue or by clicking in the view screen, and in places that support edit functions. If you remove it from there, it's effectively read-only (barring place 2)
If you put a field on a transition screen, then the user can change the content during a transition. That's "move edit into the workflow". Transitions are locked to status and can be controlled with conditions and validators.
If you want to remove "edit" for all fields of an issue because it's in a status, then the best option is to use workflow properties - set jira.editable = false on the "archive" status in your workflow. (Have a look at the default uneditable JIRA workflow - it has the flag set on "closed")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nic - thanks - the last thing you said sounds perfect for what I want to do. Unfortunately I can't view the properties of that JIRA workflow's 'closed' status precisely because it's uneditable.I tried putting jira.editable in the property key and 'false' for property value but I get Key starts with 'jira.' but is not known to JIRA...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, sorry, I usually take a copy of it, which you can then edit.
But it's also on https://confluence.atlassian.com/jira/workflow-properties-189949.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Brilliant - it's jira.issue.editable - thanks a million!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Right: the field can still be changed during a Bulk Edit. Is there any way to prevent that? I used SR to make a field Read-only, but even that does not prevent a user who has the bulk update permission from making changes to this field!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, Behaviours can't prevent bulk-edit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Wow - that's disappointing. Guess we'll have to hand out that Bulk Edit permission more sparingly...
Thanks,
Jozef
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The JIRA Field Security Plugin prevents bulk updates, but it brings lots of other issues. I'm ready to give up on it because its not worth the trouble.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The "new Jira issue view" does away with the distinction between the Edit and View screens, so unfortunately this answer is no longer relevant.
As far as I can see, there is no longer a way to make a custom field read only.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The answers remain valid for Server, and Cloud users on Classic projects. Next-gen is very different, and is expected to re-implement issue security soon, at which point the answers will become right for it again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We're on Jira Cloud and our projects were created before Next-gen rolled out, thus I assume we are "Classic".
We have a few screens in use, but can't see whether they are Create, Edit or View. Most screens I deal with have names like "default issue" or "workflow". If I delete a field from these screens then I can no longer see it.
I wonder if the implication here is configuring things differently than now, to allow read only custom fields. Please advise of the steps I'll need to do. I've read these posts, but can't seem to connect the dots.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Liwei,
If you only add those field on the issue create screen and don't add those fields to the edit screen in or any screens you use during your workflow they should not be editable after doing an issue creation.
Best regards,
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Peter.
But if i create an isolated edit screen or view screen, the fields would be viewed during the workflow lifecycle.
I would really like the fields to be viewed and also non-editable.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Besides using a plugin the normal way to archive this is to remove the field from the edit screen and add a transition to the corresponding workflow with a transition screen which contains the field. Access to the transition can be controlled through workflow conditions.
Henning
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Henning~~ i think the transition control is a good idea, but the default tranisiton conditions provided by JIRA is really limited. But i will try your advices.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Liwei,
I think that should be possible using Behavious plugin, as it allows you to make certain fields to be read-only.
You can download the plugin here:
https://marketplace.atlassian.com/plugins/com.onresolve.jira.plugin.Behaviours
Similar discussion was in the following Answers:
I hope that helps.
Cheers,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Cheers~~Plugins, i love it. but i am not the system admin, and current there is no plan for inviting any plugins in our company JIRA support team
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm sorry to hear that.
Let's wait and check if there are any users who can suggest some better workarounds which might work on your side.
Cheers. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Behaviours became part of Scriptrunner several years ago.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Team,
We have a requirement to make editable only 2 custom filed from edit screen out of 30 for a specific group only i.e project developer role can edit 2 fields only.Is it possible using Behaviour (Adaptavist script runner) ?
Regards,
Sushanta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can hide/show field to specific group by using following scritp, chenage custom field id, group name as per your requirement
<script type="text/javascript"> jQuery(document).ready(function($) { JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) { hideFieldForGroup(); }); hideFieldForGroup(); function hideFieldForGroup(){ var user=getCurrentUserName(); var statusText=$('#status-val').text(); var status=$.trim(statusText); if(isUserInGroup(user,'Developers') && status=='In Progress'){ $("#customfield_10571").closest('div.field-group').hide(); }else if(isUserInGroup(user,'Users') && status=='Open') { AJS.$("#customfield_10571").closest('div.field-group').show(); } } function getCurrentUserName() { var user; AJS.$.ajax({ url: "/rest/gadget/1.0/currentUser", type: 'get', dataType: 'json', async: false, success: function(data) { user = data.username; } }); return user; } function getGroups(user) { var groups; AJS.$.ajax({ url: "/rest/api/2/user?username="+user+"&expand=groups", type: 'get', dataType: 'json', async: false, success: function(data) { groups = data.groups.items; } }); return groups; } function isUserInGroup(user, group){ var groups = getGroups(user); for (i = 0; i < groups.length; i++){ if (groups[i].name == group){ return true; } } return false; } }); </script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes, jquery plugin will be included in jira, you can use AJS(Atlassian JavaScript) frame work also
check this
https://developer.atlassian.com/display/AUI/Getting+Started+with+AUI
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Funny. Where are you going to put this script? At least you need to have access to Jira working directory (to modify vm templates). And merge your changes each time Jira upgrades. Not really a good way to my opinion.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rambanam,
Can we use the above script for hiding custom field according to user role permission. Actually my requirement is."Label field should be visible only to admin role users" on create screen.
Regards,
Tushar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Liwei,
You would need to develop your own custom field to achieve this functionality.
Thank you
Bhushan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Why not write your own custom field that is editable by selected project roles or groups?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.