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
Hey Vishal, thanks for your help with this one. I changed the method to a Scheduled Job (makes more sense in my head), and the job failed with an invalid json structure. I'll give Bill's method a try to see if that solves it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
Hey @Bill Sheboy
This has been working really well for us. I was just wondering if you had any idea of how I could add a condition to only include versions that are either unreleased or release, i.e. explicitly NOT archived?
Thanks,
Jonathon.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jonny
That would require an extra step for this scenario to filter for the desired state first, storing the results in a created variable. For example:
{{#lookupIssues}}
{{#fixVersions}}
{{#if(not(archived))}}{{name}},{{/}}
{{/}}
{{/}}
{
"fields": {
"versions": [
{{#varNotArchivedVersions.substringBeforeLast(",").split(",").distinct}}
{
"name": "{{.}}"
} {{^last}},{{/}}
{{/}}
]
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.