Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can't identify sprint ID through Automation webhook by name

Stefan Musch April 11, 2025

The core idea is that we want to move issues that are linked (blocked by) to a new sprint if the sprint of the issue that's blocking it gets moved. All of our sprint have the following common names: 2025-12...2025-52. 

So for example:

Issue A (sprint 2025-15) blocks Issue B (sprint 2025-17)

And Issue A is moved to sprint (2025-17) then subsequently, issue B is moved to sprint (2025-19). 

I've been able to parse and calculate the DeltaWeeks appropriatly and stored that in a variable. Similarly, I've been able to get the bNewWeek (2025-19) appropriately and stored it in the variable bNewWeek.

Now the problem is that I need to set the sprint through an ID, not the name. I was thus able to send a web request and retrieve all future sprints. My log at this point is:

DeltaWeeks = 1 | bOldSprintName = 2025-23 | bNewWeek = 2025-24

And the web response looks like this: 

{id=628, self=https://gradientwiki.atlassian.net/rest/agile/1.0/sprint/628, state=active, name=2025-15, startDate=2025-04-08T13:37:34.000Z, endDate=2025-04-13T21:27:32.000Z, createdDate=2025-02-14T14:46:49.150Z, originBoardId=10},
{id=656, self=https://gradientwiki.atlassian.net/rest/agile/1.0/sprint/656, state=future, name=2025-16, createdDate=2025-03-17T10:11:46.161Z, originBoardId=10}

Now, if I hardcode the sprint name as below, I correctly assign the ID to a variable called 'sprintID' 

{{#webResponse.body.values}}{{#if(equals(name,"2025-15"))}}{{id}}{{/}}{{/}}

 

But when I try to add the bNewWeek variable it fails and doesn't return anything.

 {{#webResponse.body.values}}{{#if(equals(name,bNewWeek))}}{{id}}{{/}}{{/}}

I've tried a million things to make it work and been using an LLM to help me figure it out, but I just can't do it. Would love to get some help. 

Thanks,

 

Stefan

 

 

1 answer

1 accepted

1 vote
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 11, 2025

Hi @Stefan Musch -- Welcome to the Atlassian Community!

First thing, I would not recommend using any bot to answer Jira questions (perhaps even the Atlassian-supplied ones).  Each Jira version, site, project, issue type, etc. has its own configuration for your site and such tools do not have access to that information in order to make "guesses" to match.

 

Next, you are encountering a common limitation of automation list iterators: they cannot access information from outside the scope of the iterator.  That is, your created variable, bNewWeek, cannot be seen inside to perform the list filtering.  Here is one of the open suggestions to fix that limitation: https://jira.atlassian.com/browse/AUTO-490

For your scenario, one possible workaround is to use another created variable to dynamically build a regular expression and then use that with the match() function to get your target sprint's data.  Then use additional text functions with inline iteration (rather than the long-format with pound # sign) to parse the results to get the ID.

 

Kind regards,
Bill

Stefan Musch April 14, 2025

Hi Bill,

Appreciate the help! I've been trying to work this out, but still can't quite get the match function right. I've tried this:

{{webResponse.body.values.match("id=(\\d+),.*?name={{bNewWeek}}").get(0)}}

and 

{{webResponse.body.values.match("id=(\\d+),.*?name={{bNewWeek}}")}}

Or even this:

{{webResponse.body.values.substringBefore("name={{bNewWeek}}").split("id=").last().substringBefore(",")}}

but it doesn't produce any values. Would you be able to take a look and see what I'm doing wrong here? As a reminder, this is what the body.values returns:

{id=656, self=https://gradientwiki.atlassian.net/rest/agile/1.0/sprint/656, state=future, name=2025-16, createdDate=2025-03-17T10:11:46.161Z, originBoardId=10}, {id=657, self=https://gradientwiki.atlassian.net/rest/agile/1.0/sprint/657, state=future, name=2025-17, createdDate=2025-03-17T10:11:47.585Z, originBoardId=10}

Appreciate it!

 

Stefan Musch April 15, 2025

For those looking for an answer, I got this to work:

{{allSprints.substringBefore(bNewWeek).split("id=").last().substringBefore(",")}}

 The problem was that I was wrapping the bNewWeek inside curly brackets, inside the overall curly brackets, which was not necessary.

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events