You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
Hey there community,
I'm trying to set up a rule that is getting quite complex and hoping someone here can help me out. Here's what I have so far in the rule:
So far so good... Now I have some formatting requirements that seem to be eluding me. The final result should look like this:
There are three requirements coming into play:
Appreciate any insights for this.
The distinct part...
The first attempt
This is not working because once you create a smart value-variable in Jira automation it turns it into a string, so it's not an array anymore, there for distinct will not work.
What value did you get when this was run? This seems to be the correct syntax.
Thank you for the quick response @Garrett McCreery
It still returns all values. Here are the results of my sample issue where I'm still using distinct against the lookupIssues result (I've highlighted the dupes in bold):
, , , , , , , , , , , , , , , , , , , , , , , , , , , 
Spent a couple hours on this one yesterday and just can't seem to get this one to play nice.
ok, I figured out how you can do this...
Take your result variable, and split it by commas with the distinct function...
Then you can use the replace method to get it back to the pipe separator.
The split function turns it into an array (or "list") where the distinct function can be run!
Perfect! That solves two of the three requirements. Any chance you have any pearls of wisdom for creating a new line after each 10th result?
Thank you again.
I think the new line will depend on what application you are writing it out to. Where are you writing it to, a Jira field?
Since Jira Automation does not have a real action/branch that can do looping, you would have to create a separate automation rule that can loop itself until you reach the end of the divisible by 10. It's more than I can show on the community chat. But I hope that helps.
I use the incoming web hook automation rule whereas I pass in the initial list, use substring, split, etc to get to the first 10, save that in a different array looking variable, remove the first 10, and call the incoming webhook (itself) with the original (minus the first 10) and the new variable. I will check to see if there are 10 items left before calling itself.
When there are less than 10 left is when I would write it out to a field.
Does that make sense?
This does make total sense and I was thinking that I may have to go the route of an additional rule to edit the field after the fact. Thank you for all of your help on this. I'm marking this as answered.
Hello @Garrett McCreery ! I have what I believe is a similar type of a problem you helped solve for Mark with not being able to use the distinct to remove duplicates.
I have tried to figure out what you did here but have been unsuccessful thus far
Do you mind taking a look at my use case?
I've tried so many different things and am stumped