Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

setting field default value for a specific group of users.

Kurt Callebaut
Contributor
May 21, 2019

Hi, i find some posts, but did not find a real answer to it, so...

 

How can we set a default value in a custom field, depending on the user that is logged in ?

i also cannot set the user group by default, like user is automatically set to reporter field.

 

anyone any idea ?

3 answers

1 vote
Kurt Callebaut
Contributor
May 21, 2019

Wel, i found it as a payed plugin.

And its getting a bit expensive to add plugins each time atlassian missing a feature that should be standard for such a tool. but good news is there is a free alternative... hope this works also... 

https://marketplace.atlassian.com/apps/1218755/mygroovy?hosting=server&tab=overview

I suggested/proposed Jira for my company, but i cannot propose new additional prices to our management each week and each time i try to configure/setup jira.


Running into all those issues and additional fees, i hope it was a good choice. :(

Kurt Callebaut
Contributor
May 21, 2019

damn , seems only server, not cloud version...

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2019

Hello,

You can do it if you are on Jira Server/Data Center. You would need to use an app like Power Scripts or ScriptRunner.

If you want to use the Power Scripts add-on, then you would create a Live Field with a code like this:

 

if (userInGroup({"jira-users"}, currentUser()) {
   lfSet("customfield_10120", "your value");


}

You can read more about Live Fields here:

https://confluence.cprime.io/display/JJUPIN/Live+Fields

0 votes
Alejandro Alvarez Vazquez May 21, 2019

Hi!

I suppose you refer when creating the issue. Using ScriptRunner you could create a postfunction. Something like:

def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
def isInGroup = ComponentAccessor.groupManager.getUserNamesInGroup(equipoQaUsers).contains(currentUser);
CustomField yourField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_XXXXX");

if (isInGroup){
yourField.updateValue(....)
}

Kurt Callebaut
Contributor
May 21, 2019

Sounds good. Thx.

 

Yes when creating an issue.

Never added script. i suppose we can in cloud version ?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events