Hello and thank You kindly in advance.
Using a JSM automation that is passing JSON data to a webhook. In the automation, I have the following custom code:
{
"issueKey": "{{issue.key}}",
"summary": "{{issue.summary}}",
"requestType": "{{issue.Request Type}}",
"issueUrl": "{{issue.url}}",
"approvalId": "{{approval.id}}",
"approvers": "{{issue.Approvers.accountId}}"
}
When passed to the target schema, the outputs line up perfectly EXCEPT the approvalId data. Every other variable at the target is filled in correctly. Only the approvalId variable is NULL.
I've tried changing the target schema to look for type 'int' instead of 'string', but see that the webhook JSON is sending 'string' for that variable, so the 'string' seems correct.
I've tried changing the smart value in the JSM automation to {approval.id} / {approvalId} / {approval} . Nothing seems to get passed into the webhook, as if none of those are the correct smart value for JSM.
ex:
ANY thoughts are appreciated. I couldn't find info on this specific {approval.id} smart value on the JSM smart value page, informative as it was.
Take care and be well!
Hi @Alejandro K_ Brown ,
Assuming you do not have multiple fields called Approvals, you can use:
{{issue.Approvals.id}}
This will give you a list of all approval ids. If you only have one person that approved, you can use:
{{issue.Approvals.first.id}}
If you have multiple fields which are called Approvals, you should search for the customfield id (e.g. customfield_12345), then you can use:
{{issue.customfield_12345.first.id}}
Note: an approval can be approved or decline, so make sure you consider {{issue.Approvals.first.finalDecision}} if that is applicable in your case.
Cheers,
Rudy
This may age me, but so what.
Rudy is On Fire...
BOOOOM-SHAKA-LAKA!!!!!!
/// {{issue.Approvals.id}} ///
is *EXACTLY* what I am looking for!
Thank You very much your insight @Rudy Holtkamp
Quick follow up if You don't mind:
Not only do I see the target app "approvalId" field populated (THE CROWD WENT WILD!!!), I see multiple numbers populating the target field. Am I correct in assuming that these are ALL the approval IDs of the multiple approvals I've been test denying on this test ticket?
Also! Are the approval ID #s unique to the ticket (other tix in the same SPACE can have approvalID #818), the SPACE (other tix in other SPACES can have approvalID #818), or the entire JSM environment ((NO other tix in JSM can have approvalID #818)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great questions.
Am I correct in assuming that these are ALL the approval IDs of the multiple approvals I've been test denying on this test ticket?
Yes they are all the approvals (approved & denied) you have given in this test ticket.
You can see them in the UI, in the activity > approvals tab (That is next to the comments)
Also! Are the approval ID #s unique to the ticket, the SPACE or the entire JSM environment?
They are unique throughout your instance.
Kind regards, have a nice weekend and keep on dancing! 💃
Rudy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Got another quick question for about JIRA smart value array handling.
I want to access the LAST array index in smart value array {{issue.Approvals.id}}.
Your code:
{{issue.Approvals.id}}
always returns all the indexes in the above list {796, 805, 806, ... }
And {{issue.Approvals.first.id}}
always returns the 1st index in the above list {796}
But as I'm testing, the LAST approval number will increase. This is the index I want to do work on.
I tried guessing
{{issue.Approvals.last.id}}
But automation runtime audit log said "nice try buddy - NO".
Any suggestions?
Thank You kindly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you already take a look at the following reference page - https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--approval--
Also, you can find out all the fields' smart value associated with your issue by following this reference page -
https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/
Hope this helps..
Best, Joseph
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Joseph!
I did check out those pages, which got me closer, but still missing the "approvalId" smart value.
In the target app that is looking for the updated webhook, it sees the following data in the webhook (redacted for security.) We can see that every other variable in the webhook has correct data. Except for the "approvalId" spot, which is an empty string.
As if I might not have the smart value right in the 1st place.
This also verifies that the webhook data content-type is JSON (had to manually type that into the additional info of the JSM automation).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Without seeing all the details of your rule and audit log, I wonder: what is the trigger for your rule? The {{approval}} smart value is only populated with the approval-related rule triggers:
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--approval--
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bill, I can share what the automation trigger looks like.
But even on that page You shared, it doesn't mention {approval.id} unless the Approval ID is one of these other smart values?
To clarify, when the ticket status is set to [APPROVAL PENDING], and those conditions are applied, POST that data in the webhook. The other variables are successfully filled in except "approvalId".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Reviewing the documentation from that link, the two triggers which support the {{approval}} smart value are:
Additionally, the documentation does not show an id attribute, while it does show others. Please note that not all attributes are in the documentation; often experimentation is required to find the others.
Where did you find {{approval.id}} documented?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Following up on your question Bill:
"Where did you find {{approval.id}} documented?"
NOT in the JIRA/JSM docs that I could easily find, that's for sure.
It was suggested by 2 different AI's (CoPilot and Gemini).
Thank You again and be well!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for that information, @Alejandro K_ Brown and...
I recommend not using any bot / "AI" suggested information regarding smart values, actions, etc. for automation rules...including the stuff provided by Atlassian. My understanding is none of these tools have access to your complete product, configuration, space, etc. information, and thus the "guessers" may hallucinate based on unrelated sources. To mitigate risks of using them, consider validating the guesses in a separate testing site away from your prod site (not just a test space), perhaps with only logging actions rather than modifying work items until the suggestions are validated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I sincerely thank EVERYONE who time out of your busy day to share some knowledge and help out.
I appreciate your time and help and wish You all continued uptime, quick issue fixes and an enjoyable weekend.
Take care and be well!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
An approval ID can only be seen by using the JSM API, call;
/rest/servicedeskapi/request/<key>/approval
In this call the ID of the approval on that issue can gotten.
To get detail per specific ID, use; /rest/servicedeskapi/request/<Key>/approval/{approvalId}, but you have to to the earlier call first to get the ID.
There is no smart value you can use for this, rather ten getting the ID and store this into a custom field on the issue.
Also it only applies to issues not approved.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank You kindly Marc! I will definitely keep this in mind if future apps need to use the JSM API
Take care and be well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the reply and that's solved for you.
I didn't understand you where looking for the approvals, as this indeed relates to approval given, declined or pending.
I thought you where looking for a specific approval ID
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.