Hey, I'm planning a trigger automation to pull out the Fix Versions from the triggerIssue's linked issues and then add those Fix Versions to the Affects Versions of the triggerIssue.
I'm getting stuck quite early, I can't seem to format the values coming from lookupIssues well enough. Nor can I get the formatting of the advanced editing action to be right.
As well as I'd need to consider multiple linked issues, and multiple fixVersions too.
Am I overthinking this?
Thanks, any help is plenty appreciated.
FixVersion and Affects Versions are a list field.
You can start by creating a variable and create a json string of matching fixVersions like this
{{#lookupIssues.fixVersions}} {"name": "{{name}}"}, {{/}}
Then when you edit the fixVersion use something like
{
"fields": {
"versions": [ {{varFilteredFixVersions.substringBeforeLast(",")}} ]
}
}
see if you are able to make progress with this logic
Hi @Jonny
When trying to extract the distinct versions from a Lookup Issues result, please consider that the Lookup Issues result is a list of issues and the Fix Versions field is a list. Thus a list of lists will appear like this: [version A, version B], [version B], [], [version C]... Adding that directly will attempt to add duplicate values to the Affects Versions field or fail in the JSON.
To extract the distinct values spanning all of the issues in the lookup result, the newly revealed flatten function may be used with the distinct function:
{{lookupIssues.fixVersions.name.flatten.distinct}}
That list may then be iterated to create a dynamic JSON expression to add them:
{
"fields": {
"versions": [
{{#lookupIssues.fixVersions.name.flatten.distinct}}
{
"name": "{{.}}"
} {{^last}},{{/}}
{{/}}
]
}
}
Kind regards,
Bill
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.