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
Thank you for the help to clarify any future folks with same question...
Thanks to @Mikael Sandberg
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sam,
Thanks for the idea. I was just confused on setting up API auth with token.
Thanks,
Andy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you tried {{approval.completedDate}}, that should return the date when the approval was done.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You could make a call to Get approval endpoint to get the date, it is in the "completedDate" section. Just look for "approverDecision": "approved".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.