Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Automation for Jira : How get the approver value Display name?

Edited

Hello! 

i'm trying to generate a custom Approval email, i tried using the Customer Notification but i have custom field from Insight what i need to add. Seems not possible using this function and i'm trying with Automation for Jira. 

I making the email template and i don't find the good smart value for the Approver(s). I don't find the response here : https://support.atlassian.com/jira-software-cloud/docs/what-are-smart-values/

 

I tried 

{{#issue.Approver}}

{{issue.Approver}}

Is it possible to get back this value? 

Other question: Is it possible to get back the value of an Insight custom field? 

Additionally, can we have the approval button to a Jira automation ?

 

Thank you !

4 answers

2 accepted

1 vote
Answer accepted

With Automation for Jira, is there a way to add an Approve/Decline button to a custom email notification?  

Hello,

i don't found that  

Like Obama likes this

Have you found a solution to this problem? I'm looking for options myself.

1 vote
Answer accepted

Hello,

 

to display the approver, i found : {{issue.Approvers.displayName}}

Use the following:

 

{{issue.customfield_10026.approvers.get(0).approver.get(0).displayName} Should pull the first alphabetical name of the approvers list. then your next entry would be {{issue.customfield_10026.approvers.get(0).approver.get(0).displayName} and incrementing the number for each approver.

 

In your case replace customfield_10026 with the customfield number that Jira created for the Approvals field.

 

{{issue.{replace with Custom Field number for the field Approvals in your instance}.approvers.get(0).approver.get(0).displayName}

 

If you want a incremented list in a new field and populate it would look something like this.

{{issue.customfield_10026.approvers.get(0).approver.get(0).displayName}} - {{issue.customfield_10026.approvers.get(0).approverDecision.get(0)}}\\{{issue.customfield_10026.approvers.get(0).approver.get(1).displayName}} - {{issue.customfield_10026.approvers.get(0).approverDecision.get(1)}}\\{{issue.customfield_10026.approvers.get(0).approver.get(2).displayName}} - {{issue.customfield_10026.approvers.get(0).approverDecision.get(2)}}

 

Alex Smith - Approved

Doug Jones - Pending

Tyler Johnson - Pending

 

Hopefully the first part will help you though if you only need emails on pending.

The above is working for me, but I want the email to address only the individual recipient of the email, not everyone on the approvers list. {{issue.approvers.displayName}} shows a comma separated list of approvers. Is there a way to iterate on this, so that the email goes to all pending approvers, but the body references only that specific recipient?

 

For instance, approvers list contains: Jane Doe, John Smith,

I want the email to say:

 

Dear {{issue.approvers.displayName.SOMEFUNCTION}},

This is my message.

 

So that Jane's says

 

Dear Jane Doe,

This is my message.

 

and John's says

 

Dear John Smith,

This is my message.

 

But instead, I'm getting

 

Dear Jane Doe, John Smith,

This is my message.

I have the same issue, how to get the single name?

 {{issue.approvers.get(0).displayName}} Should pull the first alphabetical name of the approvers list. then your next entry would be {{issue.approvers.get(1).displayName}} and incrementing the number for each approver.

{{issue.approvers.get(0).displayName}} - {{issue.customfield_10026.approvers.get(0).approverDecision.get(0)}}\\{{issue.approvers.get(1).displayName}} - {{issue.customfield_10026.approvers.get(0).approverDecision.get(1)}}\\{{issue.approvers.get(2).displayName}} - {{issue.customfield_10026.approvers.get(0).approverDecision.get(2)}}

There is a caveat to this though as I found out. The approvers values are pulled off a alphabetical list.  When Jira generates the approvers list that shows pending or approved, If someone approves it could send to the wrong person. What i am observing is that when someone approves, their name is resorted alphabetically with all those that approved listed first and then those that are still pending approval listed last. If you try to do a incremental positional return of the list of approvers values it then is out of order.

 

I actually then utilized the automation tools to trigger a update of a field that displays these status

 

Alex Smith - Approved

Doug Jones - Pending

Tyler Johnson- Pending

 

When Tyler Johnson approves I find that because of how the approvers are listed it displays this.

Alex Smith - Approved

Doug Jones - Approved

Tyler Johnson- Pending

 

I think Jira reorders the list of names so that all approvers are listed first. The get tells it to grab the first alphabetical name and then the second, and then the third.

Hopefully the first part will help you though if you only need emails on pending.

 

Like Cronje van Heerden likes this

@Alex Sprague - thanks, your contribution helped me with what I wanted to do. 

We allow 2 or more approvers to be added, and I wanted to send out a notification/comment that shows who the remaining pending approvers are.

I've found nothing yet that would trigger an autoamtion/webhook when an approval is added, but as a workaround, I've created a scheduled JQL Automation rule (all issues pending approval).

The following smart value formatting shows me the list of pending approvers for each of the approvers.

{{#issue.customfield_10027.last.approvers}}
{{approver.displayName}} - {{approverDecision}}
{{/}}

Output e.g. :
User 1 - approved
User 2 - pending

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

Send an Email or Publish to Confluence - What should you do with your release notes?

Background When you hear the words ‘Release notes’, almost always you think of an unsolicited email from a software vendor. But I am here to tell you that from our data, sending release notes via E...

135 views 1 2
Read article

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