I have a manually triggered automation rule. It pings OpenAI, and returns a smart value. This smart value has a pattern (like an array but not officially) and I'd like to know if I can split the value and create multiple subtasks from it. For example:
{{webResponse.body.choices.message.content}} will return Subtask1,Subtask2,Subtask3,Subtask4 via log.
So I wanted to use {{webResponse.body.choices.message.content.split(",")}} to separate them by commas and hopefully use them as new Subtask names and create subtasks from them.
Is this possible? I've attempted using the split function of smart values and haven't had luck.
From what you describe, it seems that REST API call is already returning a list and not an array.
One simple way to test that is to try to iterate over it an write to the audit log this:
{{#webResponse.body.choices.message.content}}{{.}}{{/}}
If it writes the values you expect, you can then try using an advanced branch to create your subtasks:
Kind regards,
Bill
Hey @Bill Sheboy thanks for the additional tips! I have a semi-working version now using some trial and error this morning, but there's one looming question which I fear I might already know the answer to.
Does Atlassian automation support and kind of iterating/while loop?
Ideally I'd like to:
I've successfully accomplished steps 1-3, but I have no idea how to create any kind of while loop, or iterate via automation and create subtasks until it detects no more.
For anyone looking this thread up later, the way I solved steps 1-3 were:
But this method doesn't have looping, so it only works if I know exactly how many tasks are being returned. Right now I've asked the AI to only return 5, so I manually create 5 tasks in my automation and inject the task name using the split above. But it wouldn't work if we wanted the AI to return a dynamic number of tasks based on how many it thinks there should be.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes: you may use advanced branching for that, as described below and in my earlier post:
Basically you name a branch variable and supply a source, such as a list, split/delimited text, or collection of issues. There are limits for such branches, so read here to learn about the processing limits for automation rules:
https://support.atlassian.com/cloud-automation/docs/automation-service-limits/
Something key to know about automation branches:
Please consider the goal of your rule, as the #2 type often will not finish before the next rule steps after the branch. So if you need some result based on the branch, consider other solution approaches than branching.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For example, when I attempt to create new subtasks using {{webResponse.body.choices.message.content.split(",")}} it tries to jam the entire Subtask1,Subtask2,Subtask3 etc into the summary of the subtask. Looking for any kind of way to separate the split content into multiple smart variables.
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.
Show up and give back by attending an Atlassian Community Event: we’ll donate $10 for every event attendee in March!
Join an Atlassian Community Event!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.