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

Sander Theetaert December 7, 2017

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 votes
Sander Theetaert December 20, 2017

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.

0 votes
Johnson Wang December 18, 2017

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 Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 19, 2017

That video says it is a workflow post function

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 19, 2017

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

0 votes
Matt Doar
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 7, 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

Sander Theetaert December 8, 2017

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...

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 8, 2017

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.

Suggest an answer

Log in or Sign up to answer