Change the issue security level on workflow transition
Asked by Heiko Meng:

Hi,

In our company, we use different security levels on issues. We can manually switch between the two security levels using the lock symbol. Now, the levels should be automatically set during a workflow transition. However, when I configure the post function in the transition, it doesn't get executed. The user, in this case me, is assigned to the appropriate project role and also has the permission to set security levels. Manually, this is indeed possible.

What could be the problem here?

Thanks in advance.

Heiko


Answers:
author: Lisa Forstberg
body: Hi!

I am doing this is one of my environments, but I have chosen to solve the need with Automations instead. I wonder if I had the same problem as you with the postfunction...or if I just happened to choose that solution option.

If you choose an Automation make sure Project Role (atlassian-addons-project-access) has the Set issue security permission

br

Lisa

comments: author: Lisa Forstberg
body: Are you using this postfunction?

![Screenshot 2024-08-15 at 09.42.20.png](https://community.atlassian.com/t5/image/serverpage/image-id/341921iAA80ABB05704CD1A/image-size/large?v=v2&px=999 "Screenshot 2024-08-15 at 09.42.20.png")

I configured mine like this in my testenvironment. So the postfunction is checking that the user performing the transition is in the Project Role Administrators, then setting the Issue security level to "project admins only".

![Screenshot 2024-08-15 at 10.06.07.png](https://community.atlassian.com/t5/image/serverpage/image-id/341922iDD4058121915E4D0/image-size/large?v=v2&px=999 "Screenshot 2024-08-15 at 10.06.07.png")

It seems to be working. In the step to status Assess the postfunction is changing security level from "Open to all" which is the default security level, to "Project admins only".

![Screenshot 2024-08-15 at 10.07.35.png](https://community.atlassian.com/t5/image/serverpage/image-id/341923iC5AA3F41943C807C/image-size/large?v=v2&px=999 "Screenshot 2024-08-15 at 10.07.35.png")


author: Heiko Meng
body: Hi Lisa!

As you can see from my response to [@John Funk](/t5/user/viewprofilepage/user-id/7148) , I followed the same steps as you did in your test environment. Now I'm at a loss as to why it's not working for me.

I can change the security level manually using the lock icon, but it doesn't work automatically via the post function.

Do you have any idea what could be causing this?

Thank you once again for your efforts.

br

Heiko


author: Lisa Forstberg
body: OK so your account belong to a group that has the "Arbeitsplaner" Project Role, and this role has the correct permission and is also chosen as the validation in the post function.

You also have added your account as a default user in this project role.

Can you give us a screenshot of the project settings \> people of the project you are testing in? Just because you added your account to the default user in a project role doesn't mean that you are added to all existing projects, only the ones created after you added the account as a default user. We want to be sure that you are actually having this role in the project you test in.

To test if the group is the problem for the postfunction, add your account straight into the Project Role "Arbeitsplaner" for the particular project and test again to perform your transition.

/L


author: Heiko Meng
body: Hi Lisa,

You identified the problem and immediately solved it.

I didn't realize that the project role settings only apply to the **default** settings. Now I've added the user to my project with the corresponding project role 'Arbeitsplaner Projektrolle', and everything works as expected!

Thank you so much, you've made my day!


author: Lisa Forstberg
body: Happy to be at your service :-D

Have a nice evening!

/L


author: John Funk
body: Hi Heiko,

Have you tried making the change with an automation rule instead of a Post Function?

comments: author: John Funk
body: Can you share more information about your post function? Screenshots help. Also, there's no error? It just doesn't do what it is supposed to do?


author: Heiko Meng
body: Hi John,

Here is a screenshot of my transition:

![Post_function.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/341925i9C93FD427C5719A7/image-size/large?v=v2&px=999 "Post_function.JPG")![Settings.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/341926i7F80F3FBCA351451/image-size/large?v=v2&px=999 "Settings.JPG")

And I am a member in this project role:

![project_role.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/341934i6AFC42BA1F80F403/image-size/large?v=v2&px=999 "project_role.JPG")

![Members.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/341931i85BA456EEB25D61A/image-size/large?v=v2&px=999 "Members.JPG")

Permissions are set both for the project role and again for my group:

![permissions.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/341933i5EF7C39F2B81322E/image-size/large?v=v2&px=999 "permissions.JPG")

The transition is being executed, and no error message appears. Is there an error log?

Normally, the security level should be changed with these settings, but that's exactly the problem. It simply isn't changing.

Can you spot any mistakes?

Cheers,

Heiko


author: Heiko Meng
body: Hi,

Thank you for your responses. Due to the relatively new automation limits, we had to find an alternative. Previously, the automation worked very well for months. Now we're trying to use post functions to avoid exceeding the limit.

Are there any other ideas for solving the problem?

Best regards

Heiko


Tags: cloud

jira-cloud