Forums

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

allow only admins to transition issue if status is done (validate transition using behavior)

ramonde zrihen August 30, 2020

Hi,

I am using script runner 5.6.2

workflow i am using has ALL to ALL transitions

  1. I want to add behavior which will allow transition  from status=Done to other statuses only if curentUser projectRole ==admin
  2. i dont want to put code for status!=Done through all Workflow in validator or in conditions 
  3. when i  use Initialiser at first i get current statusName, actionName, StepName but i dont know how to validate destination transition id i want to prevent. (i know transition id values) - i am struggeling with 

    a.  IssueService.TransitionValidationResult
    b. validate transition -  IssueService.validateTransition(ApplicationUser, Long, int, com.atlassian.jira.issue.IssueInputParameters) 

  4. all other cases should be allow reporter, assignee or projectAdmins to be able to transition

 

many thanks !

Ramonde

1 answer

1 accepted

0 votes
Answer accepted
Katy Kelly
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.
September 8, 2020

Hi Ramonde, 

As Bobby mentioned in your support ticket, the only way you can prevent a transition is if there is a screen for that transition. If there is a screen you can use the 'setError' message on this screen to prevent the transition if the users is not an admin. 

You can use the setError function to prevent a user from submitting the form, preventing the transition. However, on review this would still require you to create a transition screen for every status to appear if you are transitioning from done. Therefore, the most efficient way to do this is to use the scripted condition I am afraid, there is no way around doing that without modifying your workflow. 

Regards,

Katy

Adaptavist Product Support 

ramonde zrihen September 8, 2020

Hello Katy,

i am familiar with these solutions, as i wrote "i dont want ...... through all Workflow in validator or in conditions" or to use screen error, since it forces screen to be opened no matter what


Suggest an answer

Log in or Sign up to answer