I have a web service that will return data in the form of JSON depicted beow.
I have created a new JIRA Automation Rule that uses "Send Web Request" on Issue transition from "To Do" to "In Progress".
When I use "variterate" to get "WebhookResponses.last.body" I indeed receive data but the problem is the rule doesn't reiterate. I expect to iterate under "For Each" steps in Advance Branching, but instead, it just goes inside once that's it and comes out, though I have 4 test objects in JSON. I am seeking help to fix this issue.
(Figure 1)
The below steps "desc- {{variterate.description}}
- {{variterate.get(0).description}}
- {{variterate[0].description}}
- {{variterate.0.description}} "
Doesnt print anything after multiple tries.
(Figure 2)
Web Service Response :
[
{
"title": "Happy Path - Recurring Payment Setup",
"description": "User sets up a recurring payment with valid details",
"expectedResult": "System saves the payment details and sets up the recurring payment successfully"
},
{
"title": "Expected Error - Missing Payment Details",
"description": "User tries to set up a recurring payment without entering all the required payment details",
"expectedResult": "System shows an error message about missing payment details"
},
{
"title": "Expected Error - Invalid Payment Details",
"description": "User enters invalid payment details while setting up a recurring payment",
"expectedResult": "System shows an error message about invalid payment details"
},
{
"title": "Test Edge Cases - Maximum Recurring Payments",
"description": "User tries to set up more than the maximum allowed recurring payments",
"expectedResult": "System rejects the request and shows an error message"
},
{
"title": "Test Edge Cases - Minimum Recurring Payments",
"description": "User tries to set up the minimum allowed recurring payments",
"expectedResult": "System saves the payment details and sets up the recurring payment successfully"
}
]
Hi @Amish Khatri ( @ameesh khatri )
It appears you are using two different accounts, so I mentioned both.
Have you confirmed the response body is both valid JSON and the automation rule recognizes it as a list of values?
You can do this with a test, writing this expression to the audit log after the Send Web Request action:
the count of items in the body is: {{webResponse.body.size|0}}
If the result is not the record count you expect, the body content is not parsing as a list. Instead it is likely plain text, or an array represented as text.
If it is not a list, you may use text functions, such as match() or split() to first parse the body into a list for use in the branch. Once inside of your branch you may use additional text functions to examine the data you believed to be represented as JSON fields. To learn more about those functions, please review this documentation.
Kind regards,
Bill
Let me try this @Bill Sheboy to find out whether the return JSON from the service is a list or just a text.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<EDIT> - Below discussion is not valid for this use case because Jira wasnt able to pick @Amish Khatri response was valid JSON. Need to use .match logic as suggested by @Bill Sheboy in such cases.
Hello @Amish Khatri
Please post the audit log of {{WebhookResponses.body}} so we can understand whats going on.
Cause its unclear if the JSON response you posted, is it output of log action of {{WebhookResponses.last.body}} or what... cause thats what you are logging in in your first screenshot.
So please clarify that first.
My immediate suggestion without knowing above point is, your advanced branch should be {{WebhookResponses.body}} ..
Also, for rules like these, dont directly create/update issues.
First log data every where, including the branch so you can confirm you have the data at hand before updating issues.
Finally just FYI, once inside a branch, you reference fields with dot notation... so {{variterate.description}} to pull out the description.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Kalyan Sattaluri I tried with {{Webhookresponses.body}}} and was able to print so the response is coming but under advanced branching the "variterate.description" doesn't capture .See the attached screenshots for the reference.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, lets start over.
What are you calling in your "send web request"?
And right after you have made the send web request call, can you log {{webResponse.body}} and post the JSON here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Kalyan Sattaluri these are screenshots which generated comments on story where you can see "variterate.description" hasn't generated anything. Another screenshot is about response from webhookresponses.body
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Kalyan Sattaluri below is the steps to call "send web request" and indeed receive the above JSON output.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Instead of webhookresponses.body try webresponse.body.
So can you... right after "send web request", log {{webresponse.body}} like I have it below and share the JSON.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Make your rule like I have below and share complete audit log. Please pay attention to highlighted steps and dont bother updating comments yet.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Below are comment logs received from the automation rule @Kalyan Sattaluri . You can see " desc - " which means, it doesnt print variterate.description however it has printed Webhookresponses.body as "WebhookResponses.body"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you see my earlier posts and what changes I suggested you do to your rules? Your requirement can be solved simply if you just follow those steps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Kalyan Sattaluri tried the way you asked to change but not printing after changing webresponse.body.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am assuming {{webresponse.body}} gave you the JSON you posted in your first post.
So Unless you post full screenshot of your audit logs, we cannot tell or help.
Just log it like I have it in my screenshot.
So, I cannot engage further unless you post screenshot of your full rule/complete audit log.
Audit log should specifically show {{webresponse.body}} captured before you branch.
And for the love of god, please stop updating comments and posting that screenshot alone. It tells nothing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Kalyan Sattaluri , Below is the complete audit log which you requested. I have changed the rule as per your suggestion with {{webresponse.body}} . Though you see the first box of rule in the snap has clipped, but to fit the entire snapshot I did my best to get the entire snapshot. The first step in the rule is the "send web request" only.
Apology, if you find multiple screenshots without comments before, but my machine has some slowness so my previous replies were just screen shots.
Here two snapshots, rule details and audit log respectively. Even after using webresponse.body "variterate.description" doesnt provide any value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is no reason what I suggested should not work.
Even though I have asked you to log both outside and inside the branch, You are NOT logging me details inside the branch and instead putting comments directly in rule.
When you add comments to tickets which have smart values, Audit log currently does not render smart values. So it tells nothing.
And we just keep going back and forth.
Again - What I have suggested has been proven to work a thousand plus time by others in this forum. Thats how I have leant and I know it works because I have used the same logic for my rules. Its not something I have invented.
My suggestion is, take a break from this thing. Come back after some time, reread this thread fully & carefully, especially my last few posts and implement this rule from scratch.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am facing an issue with the Smart Value not rendering the value @Kalyan Sattaluri when the JSON response contains 3-4 nodes. According to my understanding, variterate should iterate the same number of times as the nodes, but it seems to iterate only once, which is perplexing.
Regarding the audit logs, I sent them to you as requested. However, I'm uncertain about what might be missing since the entire rule audit, both inside and outside the branch, is visible in the screenshot. Is there anything else you would like me to provide?
I am aware that others may have successfully implemented similar solutions. The rule I am using is quite straightforward, and I am puzzled by the ongoing issue over the past 3-4 days.
I have thoroughly reviewed this thread multiple times and have ensured that I provided all the requested information. Nevertheless, I will reevaluate it once again to see if there is anything I might have missed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If my sample JSON is like below, whose structure is exactly just like yours
[
{
"self": "https://trainjira002.atlassian.net/rest/api/3/version/10001",
"id": "10001",
"description": "MY DESCRIPTION 4",
"name": "RELEASE 4",
"archived": false,
"released": false,
"projectId": 10000
},
{
"self": "https://trainjira002.atlassian.net/rest/api/3/version/10002",
"id": "10002",
"description": "MY DESCRIPTION 3",
"name": "RELEASE 3",
"archived": false,
"released": false,
"projectId": 10000
},
{
"self": "https://trainjira002.atlassian.net/rest/api/3/version/10003",
"id": "10003",
"description": "MY DESCRIPTION 2",
"name": "RELEASE 2",
"archived": false,
"released": false,
"projectId": 10000
},
{
"self": "https://trainjira002.atlassian.net/rest/api/3/version/10004",
"id": "10004",
"description": "MY DESCRIPTION 1",
"name": "RELEASE 1",
"archived": false,
"released": false,
"projectId": 10000
}
]
My rule is like below, (as I have suggested to you):
Then my audit log is like below: (notice I am logging {{variterate.description}} inside branch so I know value is getting populated)
My Final Output is like below:
Your JSON structure is no different than what I have.
That is why I asked you to LOG the {{variterate.description}} inside the branch as well, which you dont for some reason.
Maybe post this thread again so others can help cause obviosly I am not able to.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Kalyan Sattaluri I replicated the way you created the rule and have seen the rule is failing because {{variterate.description}} is getting blank. Absolutely frustrating for me :(
Here are the latest snapshots:
Yesterday when I ran {{webResponse.body.size}} it shows blank as @Bill Sheboy asked to check which means there is definately problem with JSON list like response coming from the service.
If the iteration rule doesnt work I need to check match() or string functions which I have to explore it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Maybe its those leading and ending square brackets making it JSON array which Jira is not able to parse. I can think of 4 different options of varying complexity.
I would make sure #4 is an option, if not, quickly check #1 & #2 if they work, if not, you can solve it by #3.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Kalyan Sattaluri and @Bill Sheboy
The issue is fixed by #3 suggested by @Kalyan Sattaluri . THANK YOU SO MUCH for your extended help in resolution. Really Appreciated your help on this issue.
I have another problem of increasing "send web request", but I know right now its not feasible in Jira rules to increase timeout, nevertheless will check with web service publisher to optimize web service response time.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Amish Khatri @ameesh khatri
Great to hear you got it resolved.
Can you please accept Bill's response as answer cause that was the solution and when you get a chance, post your method for future folks to understand the process to take...
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.