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

Mihir Ruparelia
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.
June 21, 2022

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
padraik
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.
June 21, 2022

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.

Mihir Ruparelia
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.
June 22, 2022

@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. 

padraik
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.
June 22, 2022

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
}

Mihir Ruparelia
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.
June 23, 2022

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

padraik
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.
July 7, 2022

How did it go?

Suggest an answer

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

Atlassian Community Events