Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,259
Community Members
 
Community Events
165
Community Groups

Can you bypass an approver if they have already seen the ticket

Edited

Hello, 

I haven't found an answer to this but like to ask anyway. 

We have a scenario where by a ticket can pass through multiple approvers. In the first instance a request goes to the department manager, then based on certain field conditions to the next level. 

I have been asked to find out if its possible to prevent a single person having to look at the same ticket at 2 different approval levels. 

Example:

User A logs a ticket for department X, which goes to his line manager. 

It then goes to a 2nd stage approval which is done by department Y. 

His line manager also happens to be the 3rd approval in this chain (regardless of department). Is it possible for Jira to know this person has already approved the ticket?

Sorry if this does not make sense. If you need me to clarify then please let me know. 

If the answer is a straight no then that's fine as well. :)

Many thanks

Mihir

 

1 answer

1 accepted

0 votes
Answer accepted

You could do this with Scriptrunner:

The actual solution would depend on how your process works, but I'll make the following assumptions for the example.

  • There is a new status for each approval stage
  • Assignment of the ticket to the next approver happens either automatically when the transitions are made, or manually beforehand.
  • You are capturing each approval in separate custom fields (type: user picker) that we'll call "Stage 1 Approver" "Stage 2 Approver" etc

A solution for this scenario would be to attach a script to a post-function for the transition to Stage 3 Approval, after the auto-assignment has been made.  The script would check the value for "Stage 1 Approver" and "Stage 2 Approver".  If either of them are the same as the current assignee, add that user to the "Stage 3 Approver" field, and transition the ticket to the next step.

@padraik thanks for this, would you happen to be able to provide an example of the script I would set up/create please. 

All assumptions are correct. 

Give this a shot: (remember, add this as a "Custom Script Post-function" to the transition, AFTER the auto-assignment has been made.

--------------

 

 

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue

def issueManager = ComponentAccessor.issueManager
def assignedUser = issue.assignee // remember this script needs to fire after the issue is assigned to the new approver since we're using Assignee to check for previous approval
def thisIssue = issue as MutableIssue

def firstApproverField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_16938") //// replace "16938" with your stage 1 approver custom field id
def secondApproverField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_16939") //// replace "16939" with your stage 2 custom field id
def thirdApproverField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_16940") //// replace "16940" with your stage 3 custom field id


if (issue.getCustomFieldValue(firstApproverField) == assignedUser || issue.getCustomFieldValue(secondApproverField) == assignedUser)
{
issue.setCustomFieldValue(thirdApproverField, assignedUser)
}
else
{
return false
}

@padraik thank you for this I will take a look and get back to you if I have any issues 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you