Approval Date Smart Values

Andrew L_ Chlup January 19, 2023

Hello,

I'm in the process of using smart values to create a summary email for an HR project through automation. Working with approval smart values has been a beast!

 

Here is the current script I'm using:
<ul>
<b>Final Decision:</b> {{issue.customfield_10029.finalDecision.last().capitalize()}}
{{#issue.customfield_10029}}
<li>{{name}} - {{approvers.approver.displayName}} - {{approvers.approverDecision.capitalize()}} </li>{{/}}
</ul>

The value issue.customfiled_10029 is our field for approvals custom field in our instance.

I need is a smart value that can be used to get the approval date.

The API docs / smart value docs imply that you can get a completedDate but I cannot seem to get it to work.

I thought it would be {{issue.customfiled_10029.completedDate}} but no dice.

References:

Thank you brilliant community for any ideas or insights you might have,

Andy

 

3 answers

1 accepted

0 votes
Answer accepted
Andrew L_ Chlup January 24, 2023

Thank you for the help to clarify any future folks with same question...

Thanks to @Mikael Sandberg 

  1. Use Basic auth for REST APIs (atlassian.com) to setup approriate key for accessing API
  2. Setup get request
    getJira.png
  3. Make sure you check the delay execution of subsequent rule actions.... box
  4. Use {{webhookResponse}} smartvalues found here: Jira smart values - issues | Cloud automation Cloud | Atlassian Support 
0 votes
Sam Harding
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 23, 2023

Hi @Andrew L_ Chlup 

Have you tried inspecting the structure of the customfield from the rest api? If you hit <your_domain>/rest/api/3/issue/<issue_key>, you should be able to see all the fields within the customfield. The smart value should reflect that structure, so if the complete date is somewhere in there, you should be able to the corresponding key to access it

Hope that helps,

Sam

Andrew L_ Chlup January 24, 2023

Hi Sam,

Thanks for the idea. I was just confused on setting up API auth with token.

Thanks,
Andy 

0 votes
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 19, 2023

Have you tried {{approval.completedDate}}, that should return the date when the approval was done.

Andrew L_ Chlup January 22, 2023

Yes. That only works if you have automation that triggers during the approval.

if you try to use in a later step in the workflow, it doesn’t return a value.

Like Boris Zozoulia likes this
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 23, 2023

You could make a call to Get approval endpoint to get the date, it is in the "completedDate" section. Just look for "approverDecision": "approved".

Andrew L_ Chlup January 24, 2023

Hi Mikael,

I tried that as well, but couldn't find any good examples of how to do that in automation.

All of the articles I could find use the webhook and basic authentication which is no longer supported.

Do you know of a good tutorial on accessing the api from automation?

Thank you for your help and responses,
Andy

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 24, 2023

Basic authentication is still supported, what is not supported is using email_address:password. Instead you need to use email_address:api_token. Have a look at Basic auth for REST APIs for more information. Basically you generate a token for the user that have the right permissions and then you use that as part of the auth. Or a more secure way is to base64 email_address:api_token and use that instead.

Like # people like this
Andrew L_ Chlup January 24, 2023

That was it! I tried similar header before but used JWT and bearer instead of basic. 

You're the best and thanks for the clarification.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events