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

Hey,

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 https://marketplace.atlassian.com/plugins/com.gebsun.plugins.jira.defaultvalues/server/overview doesn't help much)

Thanks for ideas/pointers/solutions :)

S.

3 answers

0 vote
Matt Doar Community Champion Dec 07, 2017

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!

Thanks,
Johnson

Matt Doar Community Champion Dec 19, 2017

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,

S.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,183 views 13 19
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot