On the Create screen for issues, is it possible to set a Custom Field to be mandatory for one group of users and not others?
If it's a hosted version of jira that you are using, then why don't you just write a small groovy script using script runner plugin and put that in the validation phase of the create issue transition.
Javascript messes up jira.
No, mandatory in plain Jira is an immensely simple flag. You either require a field on the issue type or you do not.
The standard approach here is a validator that reads the current users groups and checks that the field is filled as they create the issue. You'll need to find or write one to do that (I'd use the script runner)
Hi,
if you are interested, i can give you a javascript code that can help you to do it.
What is your jira version?
Please bear in mind that javascript is not a good idea in Atlassian apps. It's hard to get it right if you use more than one script because of the interference that can happen, it routinely fails and can become a nightmare on upgrades, and it's a doddle to bypass it if your users want to. (On the other hand, I've had quite a lot of work out of "please sort out our system by removing the javascript hacks")
In other words, keep javascript tricks to a minimum and avoid them whereever you can.
Hi
I quite agree with you @Nic Brough, I already had a lot of problems, but we still use it. Sometimes, we have an only solution which is javascript.
That would be perfect!
Yeah I completely agree, luckily it's on a issue type that has little else happening.
We're currently running on 6.1.4
Yes, hence the note of caution (rather than a couple of things people do where I end up screaming "no"). If you keep it light and minimal, you'll probably be ok.
Put scripts in the description of your custom field or preferably put in a plugin WebResources (to develop)
Try this scripts
//get current user logged in function getCurrentUserName(){ var user; AJS.$.ajax({ url: contextPath+"/rest/gadget/1.0/currentUser", type: 'get', dataType: 'json', async: false, success: function(data) { user = data.username; } }); return user; } //get groups of the user logged in function getNameGroups(user) { var groups=[]; AJS.$.ajax({ url: contextPath+"/rest/api/2/user?username="+user+"&expand=groups", type: 'get', dataType: 'json', async: false, success: function(data) { AJS.$(data.groups.items).each(function(i){groups.push(data.groups.items[i].name);}); } }); return groups; } // check if user in the group function userInGroup(user, group){ var groups = getNameGroups(user); return (AJS.$.inArray(group,groups)>-1) ? true:false; } //check field value user group function checkFieldValue(fieldValue,user,group){ if(fieldValue=="" && userInGroup(user, group)){//you can put more conditions alert ("Please, put some values"); } } //associate the function to event AJS.$(document).ready(function(){ if (AJS.$('#issue-create-submit').length>0){ AJS.$('#issue-create-submit').mouseover(function (){checkFieldValue(AJS.$('#yourfieldId').val(),getCurrentUserName(),your_group_name);}) //validate with mouse }})
you can associate other events
Sorry, just being dumb...
What sections do I need to change?
#yourfieldId
Where do I specify the group that a user should be in?
It looks like you're new here. Sign in or register to get started.