Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Recursive get of outwardlinks doesn't get the second-level issues

I have a series of issues which are connected by issue link, each one is an iteration of a business-process. Suppose 3 issues: 1st iteration, 2nd iteration and 3rd iteration. I need to print out in a template for email the approvers of previous iterations of the 3rd issue. But the problem is that somehow only 2nd iteration is printed with the below chunk, and the 1st iteration does not print (when testing the email on the 3rd issue) while when testing on the 2nd issue (taking it as a last iteration) the 1st iteration prints, so the problem is not with non-matching field names or link types. Please help me clarify what to change in order to make this recursive macro work for every levels.

#macro(getPreviousIterations $issue)
  			
            #foreach ($linkType in $issue.linkCollection.linkTypes)
                #if ($linkType.outward.equals("is Next iteration of"))
                    #foreach ($outwardIssue in $issue.linkCollection.getOutwardIssues($linkType.name))
                        #printApprovers($outwardIssue)
 						#getPreviousIterations($outwardIssue) ##Doesn't find prev iterations for the immediate outwardissue of the top issue
                    #end
                #end 
            #end
        #end
  
        #if ($iCount !='1') 
            <p>Previous iterations of issue were additionally approved by the following people:</p>
 			#getPreviousIterations($issue)
        #end

4 answers

0 votes
Steven Behnke Community Leader Jan 29, 2017

Can you confirm, the structure looks something like this? 
image2017-1-29 12:36:35.png

Yes, that's right.

0 votes
Steven Behnke Community Leader Jan 29, 2017

I don't know the #macro syntax – Is this a custom plugin? Just double checking.

This code is inside a template for an email, which is used by the plugin JETI https://www.meta-inf.hu/display/PLUG/Documentation;jsessionid=82109CB122D3A55E9C606BD72A4BDFB7

https://www.meta-inf.hu/display/PLUG/Add+Issue+Link+Information+to+Your+Template

The macro syntax I used was from Velocity documentation http://velocity.apache.org/engine/1.7/user-guide.html#velocimacros

I tested some behavior of the code and can report only that during the first call of the macro it works as intended, but then probably transmits to the next call not the whole issue object, so the foreach cycle doesn't envoke the second time.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Agile

Join us LIVE: Atlassian & Experts Talk Research & Insights @ Scale

Hello all! What have you learned from your customers lately? Our live-streamed series continues by exploring CX, UX, and the power of research & insights at scale with Leisa Reichelt, Head of R...

228 views 3 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you