Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Looking for $ variable in a Service Desk approval URL for Groovy

So I'm testing a looped transition that I can automate and send a custom email via Scriptrunner to remind approvers about a pending approval. I'm trying to configure a button using the same url structure as the native approve/decline buttons


There appears to be a variable in the URL which changes every time an issue enters the approval status that I need to accommodate for. the variable occurs after the issue key in the url. For example


The 1235 will increment to 1236 after the loop to trigger the custom email so I need to call a variable otherwise you will just receive an error 'the approval has been decided' in the portal.


My current url is this$issue.key/1235/approve/analytics?sda_source=notification-email


Does anyone know what the variable is that gets incremented when a ticket enters/re enters the approval status.

1 comment

HI @Steve Letch did you find something about this? Im looking for the exact same thing but I dont know if this number is stored in the ticket in any form.

I looked for the same kind of ID.

After inspecting an issue by its JSON object via I saw that the whole approval is mapped to or saved in an custom field.

The ID in the URL is the ID of the approval, e.g.:


The approval link for the issue above would be

Hope that helps someone :)

Hi @Steve Letch have you managed to get this Approval ID using groovy script? I am also looking for the same solution. Thank you! :) 

Hi @Steve Letch , @Anneta Svircenkova , @Hauke Bruno Wollentin 

I found a solution for this with the ServiceDesk API with ScriptRunner. Here is the code:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.UserUtils
import com.atlassian.servicedesk.api.approval.Approval
import com.atlassian.servicedesk.api.approval.ApprovalQuery
import com.atlassian.servicedesk.api.approval.ApprovalService
import com.atlassian.servicedesk.api.util.paging.PagedResponse
import com.onresolve.scriptrunner.runner.customisers.WithPlugin


ApprovalService approvalService = ComponentAccessor.getOSGiComponentInstanceOfType(ApprovalService)

ApprovalQuery query = approvalService.newQueryBuilder()
.issue(123) //Change with de issue ID
ApplicationUser admin = UserUtils.getUser("Administrator") // Change with your admin user
PagedResponse<Approval> approvals = approvalService.getApprovals(admin, query)
approvals.each {
log.warn it.getId()
Like Steve Letch likes this


Log in or Sign up to comment

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