Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Automation loop through WebResponse results

Nicole Ahlborn
Contributor
September 21, 2022

Hi,
I am accessing the Tempo Plan Times in an automation via Web Response. Now I would like to know how to make a loop through the individual planed packages via the Jira automations. To get the ids of a specific description to delete the entire. Comparable to the loop you can create for LookupIssues.

Logic: 

  • Loop through entries
  • Condition:  If {{webResponse.body.results.get(entries).description}} contains "Firma AB
  • Then:  Delete Plan via Web Response 

 

Web Response Result with 2 entries 
"metadata": {

"count": 2

},

"results": [

{

"id": 30,

"startDate": "2022-09-20",

"endDate": "2022-09-20",

"description": "TEST-117 - Firma XY",

"plannedSecondsPerDay": 1020,

"includeNonWorkingDays": false,

"rule": "NEVER",

"recurrenceEndDate": "2022-09-20",

"totalPlannedSecondsInScope": 1020 },

{

"id": 31,

"startDate": "2022-09-20",

"endDate": "2022-09-20",

"description": "TEST-117 - Firma AB",

"plannedSecondsPerDay": 60,

"includeNonWorkingDays": false,

"rule": "NEVER",

"recurrenceEndDate": "2022-09-20",

"totalPlannedSecondsInScope": 60

}

Is this somehow possible? Any Ideas? 
Greetings
Nicole 

1 answer

1 accepted

3 votes
Answer accepted
Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 21, 2022

Hi @Nicole Ahlborn 

I'm still a bit of a novice myself with the Send Web Request, but you would need to perform an advanced branch against {{webResponse.body}}. You'll give your branch a variable like {{varIterate}} Then for each action you want to take you would simply go with {{varIterate.YOURDESIREDATTRIBUTE}} and it will process through the results.

NOTE - There will be a limitation of 50 results it can process in a single branch.

Nicole Ahlborn
Contributor
September 21, 2022

Hi @Mark Segall 
Thank you very much! Now it has finally worked.
I had to go one level further than body ({{webResponse.body.results}}), but it works!

Like Mark Segall likes this
Suyash Rane
Contributor
June 12, 2023

Hi @Nicole Ahlborn 
I'm in a similar scenario, Can you please share how did you manage to do this one in details please?

Christine Kihanya June 19, 2023

Hi @Nicole Ahlborn or @Mark Segall , please share how you did this? I'm also in a similar situation

Nicole Ahlborn
Contributor
June 19, 2023

Hi @Christine Kihanya 

you can use the Advanced branching on Smart Values 

Bildschirmfoto 2023-06-20 um 08.02.00.png

In the step you just use an Advanced compare condition to get the one entry you need. 

e.G. check if the planed time is planned for this issue

Bild 20.06.23 um 08.10.jpeg

Greetings

Nicole 

Like Ojase Emmanuval likes this
Christine Kihanya June 20, 2023

Hi @Nicole Ahlborn ,

I'm trying to get the timestamp of the last status change.

 

This is what I've done:

The REST API url is https://<domain>/rest/api/3/issue/{{issue.key}}?expand=changelog 

With the response, I've used this smart value to display the logs starting with "On" for every line

On 2022-09-30T22:42:41.792+0000 resolution changed to Resolved status changed to Closed On 2022-09-30T20:55:15.242+0000 Workflow changed to Copy of DevOps Workflow On 2022-06-28T20:28:11.684+0000 Workflow changed to IT Testing Workflow On 2022-06-28T20:14:59.903+0000 Workflow changed to Helpdesk workflow On 2022-06-28T20:00:17.603+0000 Workflow changed to IT Testing Workflow

 

What I want is to only retrieve the latest status change created timestamp. This is what I've tried. I've created the advanced branching

My {{Hists}} variable has the below smart value. 

{{webResponse.body.changelog.histories.items.field}}

 

Condition: contains "status". But when I display the logs, I'm getting every field change, not just status 

Image.JPG

See results:

Workflow, resolution, status

 

Any help is appreciated, thx.

 

Christine 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events