How to deny user to transition between 2 specific statusses, after he made a pevious transitions

Fleur Post December 2, 2024

I do not know if and how I could do this and if I should use Jira Automation or Conditions/Validators/Post Functions via the Workflow.

To be specific these are the requests:

  • The user who triggered the transition from in Progress to Ready for test cannot trigger the transition from User Testing to transport to prod;
  • The user who triggered the transition from Ready for test to User Testing cannot trigger the transition from User Testing to transport to prod;
  • The user who triggered the transition from Transport to prod to 4Eye Check cannot trigger the transition from 4Eye Check to Done.

1 answer

0 votes
Tuncay Senturk
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 2, 2024

Hi @Fleur Post 

You can achieve that if you have Script Runner or Enhancer Plugin. If you have Enhancer Plugin, you can easily define user custom fields which can be user who did which transition but if you don't you can store those users adding post functions in your transitions. Let me explain step by step.

  • Create custom user picker fields to store the users who performed specific transitions (this can be done either manually setting each users in transitions that I will explain below, or using the Enhancer Plugin)
    • Add custom fields for each transition (Ready for Test user, User Testing User, 4Eye Check User)
    • Add post functions to transitions
      • for example from In Progress to Ready for Test, add a post function and select Update Issue Custom Field and select Ready for Test User custom field, value: Current User.
      • Ensure that this post function is placed before Re-index and fire a generic event functions
      • Repeat this for other user custom fields
    • Then add conditions or validators (using ScriptRunner) to restrict transitions
      • add > Script Condition and write something like below
        import com.atlassian.jira.component.ComponentAccessor 

        def currentUser = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()
        def customFieldManager = ComponentAccessor.getCustomFieldManager()


        def userField1 = customFieldManager.getCustomFieldObjectByName("Ready for Test User")
        def userField2 = customFieldManager.getCustomFieldObjectByName("User Testing User")
        def user1 = issue.getCustomFieldValue(userField1)
        def user2 = issue.getCustomFieldValue(userField2)

        return !currentUser.isEqual(user1) && !currentUser.isEqual(user2)

         

I hope it helps, let me know if you need further assistance

Fleur Post December 2, 2024

Thank you so much @Tuncay Senturk ! 
We do have Scriptrunner. 
I will try this out and let you know how it went 🤩

Tuncay Senturk
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 2, 2024

You're welcome!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events