Do not worry, we do not want to use due dates to add tasks to a sprint!
We have Kanban teams delivering assets to agile teams, and we want to use this method to tell agile team in which sprint they can expect a Kanban delivery.
After some research I have found a thread that almost got me to a solution, thanks to @Bill Sheboy helpful set of links.
Using the information provided I was able to send the right web request through the REST API and get a list of sprints to iterate over.
Then using smart values I can iterate through the list of sprints and log all their names and startDates,
{{#webhookResponse.body.values}}{{name}} -- {{startDate}} {{/}}{{/}}
I also tested that the due date on the test issue is fine, by just logging
{{issue.dueDate}}
Now it seems I am missing one last bit of smart values syntax. From what I can tell once you are in an iteration loop all the smart values within the loop seem to assume they are children of what you are iterating over. Let's see if I can explain this better.
Say I have 5 sprints and I iterate over them in the webhookresponse. if I print text it will just appear five times in the log. Like so:
{{#webhookResponse.body.values}} repeat this {{/}}
Now if I do the same with the dueDate it doesn't work.
{{#webhookResponse.body.values}} {{issue.dueDate}} {{/}}
The same way I was accessing the sprint start date using {{startDate}} smart values seem to assume {{issue.dueDate}} is a sprint parameter. Is there a way to access other smart values while iterating?
The idea was to trigger this rule when the due date is set on a Kanban asset, then iterate over the future sprints to find the one corresponding to that date, and save it is a "expected in sprint" custom field. But while iterating over sprints I cannot figure out how to access the due date...
Haven't fully tested the syntax but if would have to be something like this:
{{#webhookResponse.body.values}}
{{#if(issue.duedate.isAfter(startDate))}}
{{#if(not(issue.duedate.isAfter(endDate)))}}
{{name}}
{{/}}
{{/}}
{{/}}
Mind you I may be approaching this filtering problem from the wrong end?