I need to compare two Select custom fields and provide an output with the distinct values, for example:
FieldA has the values for apps: A, B, C, D
FieldB has the values for apps: C,D, E, F
I need to compare both field selections and give as output the list without duplicates.
This is important because based on the selection, I need to create a sub-task and I want to avoid creating duplicates.
Any idea how can I do it with Automation for Jira?
To my knowledge, unfortunately, this is not possible.
Values from field A will be a list.
Values from field B will be a list.
Creating a variable with these two lists, will yield an "array" of arrays, and you can't use the list.distinct smart value to get the unique values from these two field. A while ago I've tried that for another user, but couldn't succeed :( Feel free to try and if you can manage to do it, please update here!
You could do that if you had an app in which you could run groovy, or jira expressions and had built-in listeners (such as scriptrunner, or JMWE).
Yes, and...to Alex's answer: sadly there are not AND/OR operators for fields with which to do this.
If you have a limited number of selection options, you could do this with created variables, logical functions and if/else conditions...but that would be a brittle solution for maintenance. The upper limit is due to the maximum number of components allowed in a rule. For example...
You could also take a chance and build the first variable as one long string for all possible apps, although that sounds even more difficult to maintain.