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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, just being dumb...
What sections do I need to change?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
#yourfieldId
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Where do I specify the group that a user should be in?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
when you cal function checkFieldValue (
your_group_name)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Am I missing something in the code as it's showing up when I create an issue
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't see the screenshot.
Try to debug it with fire bug.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Debug showed:
<div class="field-group aui-field-cascadingselect"> <label for="customfield_11815">APS Remedy Categories</label> <select id="customfield_11815" class="select cascadingselect-parent" name="customfield_11815"> <select id="customfield_11815:1" class="select cascadingselect-child" name="customfield_11815:1"> <div class="description">//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.$('customfield_11815').val(),getCurrentUserName(),IS Monitoring);}) //validate with mouse }})</div> </div>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I will attempt to look at fire bug, in the mean time the screenshot shows the entire script in the description as if it was just plain text
https://dl.dropboxusercontent.com/u/7609815/WebLinks/31-03-2014%2016-33-06.jpg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
Put all scripts between this tag.
<script type="text/javascript">
all scripts
</script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So I'm now using the below, but it's still allowing me to create issues even though I am in the Support group in JIRA
<script type="text/javascript"> //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.$('customfield_11815').val(),getCurrentUserName(),Support);}) //validate with mouse }}) </script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
have you put this scripts in the description of a custom field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yeah I have
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try to put you group name between "" like this "Support".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
What about of your problem?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is your jira version?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
if you are interested, i can give you a javascript code that can help you to do it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
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.