Forums

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

Change issuetype/project after overwriting default security level with behaviours (scriptrunner)

Erik Buchholz
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.
April 23, 2020

We have one project (project A), where we like to have different default security levels for different issue types.

I created a script to overwrite the default value at the create issue screen. So far, so good.

Now I have seen, that when I change the issue type or the project at the create issue screen, the level will be transferred to the new issue type or project, if the security level is present on the create issue screen of this issue type or project.

If I look at other projects I see the following behavior without scriptrunner.

Project B has default level _open_.

When I switch to project C with default level normal, the level on the create issue screen switches as expected from open to normal.

How can I achieve this behavior with scriptrunner?

Would you recommend to overwrite the security level in a post function instead?

1 answer

1 accepted

1 vote
Answer accepted
Moses Thomas
Community Champion
April 23, 2020

@Erik Buchholz 

Instead of unnecessary battles with behaviors, lets make our lives easier; firstly, you don't need to have the security level(system field) on the create screen since to be honest most users don't care about this field as they don't know who is limited(group/user/roles) in the issue security setting apart from JIRA admin/Project admin, i would even remove it from screen.I suggest you do it silently with script runner post function in the create transition for the workflow

  •  Go to post-functions > Add post function > Script Post-Function > Add
  •  Choose the Set issue security level depending on provided condition
  •  In the Condition below
    issue.issueType.name == 'A'
  • Choose the security level and Update.
  • You can add more than one post function to threat different cases. if workflows are shared among several projects you can add this to the condition
      issue.issueType.name == 'A' && issue.projectObject.key == 'ET'

 

Kind regards,

Moses.

Erik Buchholz
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.
April 24, 2020

Dear Moses,

thanks for your reply.

You're completely right. Most users don't care about the security level. That's the reason, we need good defaults.

I'd like to give the few users who care the chance to change this at creation but that's not necessary.

I will give others the chance to reply before accepting your answer.

Kind regards,

Erik

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events