Hello,
Using Jira Automation, I'm trying to add all issues from a JQL search to a sprint that hasn't started yet.
According to the Rest API documentation, this can be done by making a POST request to the path "/rest/agile/1.0/sprint/{sprintId}/issue", sending the issue keys as an array.
My difficulty lies in how to implement the request in Jira Automation, transforming the values of the variable {{lookupIssues}} into the format:
"issues": [
"PR-1",
"10001",
"PR-3"
]
Hi @Jó Sales de Medeiros Júnior -- Welcome to the Atlassian Community!
Some of the helpful documentation on list iteration, such as for Lookup Issues, is not all in one place. If you look at the bottom of the section on lists, there are many helpful examples: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-lists/#Combined-function-examples
For what you are trying, you want the keys in quotation marks, separated by commas. One way to do that would be this:
"issues": [
{{#lookupIssues}}"{{key}}"{{^last}}, {{/}}{{/}}
]
That part with {{^last}}, {{/}} adds a comma followed by a space for each issue except the last one.
Kind regards,
Bill
Perfect, Bill Sheboy
Thank you very much for your help.
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.