Can you change the default value of custom create fields based on security level? Edited


I would use transitions but there is no transition before 'create' of course ;-)

We have different security groups that would need to have different default values based on those groups (levels are also configured).

What is the best approach?

(the fields that need a different default value are non default fields so doesn't help much)

Thanks for ideas/pointers/solutions :)


3 answers

0 votes

How is the security level for the issue set?

You can use a custom post function on the Create transition to do things after that is known

The security level is based upon the account (so certain users have a certain security level)

The fields that need a default value (based on that level) need to have this value already set before the create action (in the create issue screen) so a post function on the create is to late...

Security levels in Jira are based on what a user enters into the "Level" field when creating or editing the issue.

There's no way you could base defaults on the security level because

  • Defaults for fields are done by context, which is determined by project and/or issue type, not other fields
  • Even if it were possible to hang it off other fields, you don't have the security level until after you've saved it.

Hey @Sander Theetaert,

You can actually change the default value of custom fields based on security level during the create transition (and NOT using a POST function) with the Power Scripts add-on.

Here's a short video tutorial that walks you through exactly how to do this.

And here's sample code that you can use, but feel free to tweak to match you needs:

if(securityLevel == "Developers") {
    string steps;

    steps = "The following steps must occur in order to complete this task:\n";
    steps += "# Make an Observation. Scientists are naturally curious about the world. ...\n";
    steps += "# Form a Question. After making an interesting observation, a scientific mind itches to find out more about it. ...\n";
    steps += "# Form a Hypothesis. ...\n";
    steps += "# Conduct an Experiment. ...\n";
    steps += "# Analyse the Data and Draw a Conclusion.\n";

    desc = steps;

Hope that helps!


That video says it is a workflow post function

And it doesn't change the defaults in the fields, just updates the issue.

In the end we did it like this:

-> after the create there are a couple of automatic transitions

Because after reading the answers to this question not that much hope was left for having different default values based on security level...

We leave those fields empty and (indeed) after (other) post functions we set the values (based on security level) (with a groovy script)

It's not exactly the answer to the question but it is something we can live with...

Thanks for all of the input,


Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 14, 2019 in Jira

Updates to give you visibility into what's coming in Jira Server and Data Center

Hello, Community! My name is Gosia and I'm a Product Manager on Jira Server and Data Center here at Atlassian. Since 2002 when we launched our public issue tracker, jira.atlass...

560 views 1 14
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you