For example, I have project roles: Developers, Users.
I want to make my field read-only except on step "In Progress" for Developers, and except on step "Open" for Users.
As a result: ("In Progress" AND Developers) OR ("Open" AND Users).
Help, please :)
I am trying to make a text field read only on edit screen, but looks like the code is not working. can you please help with this -
jQuery(document).ready(function($) {
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e,context) {
var projectName = AJS.$("#project-name-val").text();
console.log("RFC projectName "+projectName);
if (projectName == "RFC")
{
callReadonlyFunction();
}
}
});
function callReadonlyFunction(){
$('#edit-issue').click(function() {
console.log("Edit Button Clicked Start");
AJS.$("#customfield_13911").attr("readonly", true); //text field
console.log("Edit Button Clicked End");
});
}
In the console log, I do see messages but for some reason, the field is not becoming read-only.
the behavior plug-in may offer that, but I don't know if you can have it installed.
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 following script will run on edit screen
<script type="text/javascript"> jQuery(document).ready(function($) { JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) { makeReadonly(); }); makeReadonly(); function makeReadonly(){ var editFunction=$('#edit-issue-submit').val(); if(editFunction === 'Update'){ var user=getCurrentUserName(); var statusText=$('#status-val').text(); var status=$.trim(statusText); var devlopersRoleID='10010';//changr the project role id here var usersRoleID='10011';//changr the project role id here $("#customfield_10571").attr("readonly", ''); $("#customfield_10572").attr("readonly", ''); if(isUserInGroup(user,devlopersRoleID) && status=='In Progress'){ //to make text field read only $("#customfield_10571").attr("readonly", true); }else if(isUserInGroup(user,usersRoleID) && status=='Open'){ //to make text field read only $("#customfield_10572").attr("readonly", true); } } } 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 getUsers(roleID) { var users; AJS.$.ajax({ url: "/rest/api/2/project/TEST/role/"+roleID,//change project Key here(need to replace TEST with your project key) type: 'get', dataType: 'json', async: false, success: function(data) { users = data.actors.name; } }); return users; } function isUserInGroup(user, roleID){ var users = getUsers(roleID); for (i = 0; i < users.length; i++){ if (users[i].name == user){ 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.
try with following code
//for dute field $("#duedate").attr("readonly", true); //to hide date picker icon $("#duedate-trigger").hide(); /to show date picker icon $("#duedate-trigger").show(); try with this for assignee field $("#assignee-field").attr("readonly", true);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
check the REST API in isUserInGroup(user, roleID) function
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
small clarification!
do you want field read only on transition screen or view screen?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can do it by using javascript? let me know if you want do it using JS so i can help you!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.