How to get the approver name to be displayed in a custom field after the issue is closed?

Bharat Kumar Bondalapati
Contributor
February 14, 2025

Hi Community,

I am trying to get the approver name using bulk change option to be populated in a custom field but nothing works.

I tried using:
{{approval.approver.displayName}}
{{approval.initiator}}
{{approval.name}} 

Everytime I enter above returns same value and not actual value.

Any help? 

2 answers

1 vote
C_ Derek Fields
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 14, 2025

@Bharat Kumar Bondalapati Look at the documentation, it appears that the approval smart value is only instantiated to the Approval required and the Approval completed triggers. Your bulk change would trigger the Issue Edited trigger, so the approval smart value won't be available.

The only way that I see to get the approvers is to use a Web Request. There is a Service Desk API /rest/servicedeskapi/request/{issueIdOrKey}/approval that will retrieve the approvals for the request. You can put this into your Automation and then get the first returned value. 

If you execute a GET passing in the Issue Key, you will get a body that looks like this (I removed some pieces that aren't relevant to you:

        {

            "id": "8653",
            "name": "Resolved",
            "finalDecision": "approved",
            "canAnswerApproval": false,
            "approvers": [
                {
                    "approver": {
                        "accountId": "<User Account ID>",
                        "displayName": "<User Name>",
                        "active": true,
                        "timeZone": "America/New_York",
                        "_links": {
                            "jiraRest": "https://<site_name>.atlassian.net/rest/api/2/user?accountId=712020%3A81cf15d9-5bfa-4426-ae2d-d4ff68cc6c62",
                        }
                    },
                    "approverDecision": "approved"
                }
            ],
            "createdDate": {
                "iso8601": "2025-02-14T13:20:56-0500",
                "jira": "2025-02-14T13:20:56.656-0500",
                "friendly": "Today 1:20 PM",
                "epochMillis": 1739557256656
            },
            "completedDate": {
                "iso8601": "2025-02-14T13:24:09-0500",
                "jira": "2025-02-14T13:24:09.556-0500",
                "friendly": "Today 1:24 PM",
                "epochMillis": 1739557449556
            },
        }
 

You can then access the displayName with the following smart value

{{webResponse.body.approvers.get(0).approver.displayName}}

Let me know if this helps.

Bharat Kumar Bondalapati
Contributor
February 14, 2025

Hello @C_ Derek Fields 

Thank you for your response. I used "Approver: {{customfield_10032}}" in edit custom field automation rule and it returned:

Approver: ServiceDeskApprovalsBean{id='3520', name='Waiting for IT Approval', finalDecision='approved', canAnswerApproval=false, approvers=[ApprovalDecision{approverDecision='pending', approver=UserBean{name='null', key='null', accountId='642354c65534b0bf7442b2d2', emailAddress='null', displayName='Mitchell Simmons', active=true, timeZone='America/New_York', locale='null'}}, ApprovalDecision{approverDecision='pending', approver=UserBean{name='null', key='null', accountId='712020:241972ee-1526-4143-bbdd-1efc61b37dbd', emailAddress='null', displayName='Olga Lazareva', active=true, timeZone='America/New_York', locale='null'}}, ApprovalDecision{approverDecision='pending', approver=UserBean{name='null', key='null', accountId='712020:d7390095-5237-47a2-b445-7fd3310e14f5', emailAddress='null', displayName='Kyle Meier', active=true, timeZone='America/New_York', locale='null'}}, ApprovalDecision{approverDecision='pending', approver=UserBean{name='null', key='null', accountId='712020:8384669d-b9d7-4399-81aa-59c4da7eea30', emailAddress='null', displayName='Khoa Ho', active=true, timeZone='America/New_York', locale='null'}}, ApprovalDecision{approverDecision='approved', approver=UserBean{name='null', key='null', accountId='712020:4460ccb9-db26-44f4-9fc1-3c87e63f299a', emailAddress='null', displayName='Bharat Kumar Bondalapati', active=true, timeZone='America/New_York', locale='null'}}]}, ServiceDeskApprovalsBean{id='3519', name='Waiting for IT Approval', finalDecision='approved', canAnswerApproval=false, approvers=[ApprovalDecision{approverDecision='pending', approver=UserBean{name='null', key='null', accountId='712020:241972ee-1526-4143-bbdd-1efc61b37dbd', emailAddress='null', displayName='Olga Lazareva', active=true, timeZone='America/New_York', locale='null'}}, ApprovalDecision{approverDecision='pending', approver=UserBean{name='null', key='null', accountId='642354c65534b0bf7442b2d2', emailAddress='null', displayName='Mitchell Simmons', active=true, timeZone='America/New_York', locale='null'}}, ApprovalDecision{approverDecision='pending', approver=UserBean{name='null', key='null', accountId='712020:d7390095-5237-47a2-b445-7fd3310e14f5', emailAddress='null', displayName='Kyle Meier', active=true, timeZone='America/New_York', locale='null'}}, ApprovalDecision{approverDecision='approved', approver=UserBean{name='null', key='null', accountId='712020:4460ccb9-db26-44f4-9fc1-3c87e63f299a', emailAddress='null', displayName='Bharat Kumar Bondalapati', active=true, timeZone='America/New_York', locale='null'}}, ApprovalDecision{approverDecision='pending', approver=UserBean{name='null', key='null', accountId='712020:8384669d-b9d7-4399-81aa-59c4da7eea30', emailAddress='null', displayName='Khoa Ho', active=true, timeZone='America/New_York', locale='null'}}]}

From this, how to get the name of approver? Any idea?

Like John Funk likes this
0 votes
C_ Derek Fields
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 14, 2025

Try using the smart value 

{{issue.customfield_10032.approvers.approver.displayName}}

That should return the displayName of the approver

Bharat Kumar Bondalapati
Contributor
February 14, 2025

It worked but returned all the names of approvers present in the group. It should only return the name who approved the issue.

Like John Funk likes this

Suggest an answer

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

Atlassian Community Events