Hi!
I want to add the following behaviour to a workflow:
- Hide a field when user is in a certain group AND when issue is being created.
The first condition was quite simple to include. However I'm having troubles with the latter.
I have chosen a guide workflow which has the "create" action (I believe every workflow in Jira has this action), but this action does not appear in the Workflow Action list box.
Any tips?
Cheers!!!
You have to write code to do it rather than choose options from the web UI.
You would use:
getActionName() == "Create" && <your code to see if the current user is in group X>
is there a chance to get this as a feature in a future version of JIRA?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you mean a future version of the plugin? If so you are able to do that now... maybe I'm missing something, or perhaps your answer doesn't relate to the question?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Argh, I'm sorry. I was posting in the wrong tab.
Thanks for the quick response and sorry for the confusion
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 field for specific group by using following javascript, i suggest to add it as webresource in a plugin
<script type="text/javascript"> jQuery(document).ready(function($) { JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) { hideField(); }) hideField(); function hideField(){ var issueTypeCreate =document.getElementById('issuetype-field'); var issueType =$('#issue-create-issue-type').text(); if((document.getElementById('customfield_10571') != null || (issueTypeCreate!=null && issueTypeCreate.value == "Defect") || issueType == "SVN Kit"){ var user=getCurrentUserName(); if(isUserInGroup(user,'Developers') ){ //to hide field $("#customfield_10571").closest('div.field-group').hide(); }else { /to show field 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.
Hi Felipe,
you can't add a condition to the create transition. There are only validators and post functions possible.
Cheers,
Udo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
However you could remove a field in the create screen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your answer Udo!
However you did not read my question carefully enough.
My question is related to the Jira Behaviour Plugin. So the condition I've mentioned is not a Workflow condition.
I could remove the field from the create screen, however I would like this field to appear on the screen if the users are not in a certain role.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, your question is quite ambiguous since your talking about 'create' and Workflow action as well as 'add the behavior to a workflow'.
However, maybe Ramabanams answer fit your need.
Good luck.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online 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.