Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,569
Community Members
 
Community Events
184
Community Groups

Conditionally show a fragment

Using ScriptRunner Fragments

Hey Atlassian Community! I am trying to only display a fragment when certain conditions are met. 

What I need help finding is how to actually get the fragment to show when these conditions are met. Using the script console I can verify that the script is finding everything outlined here, but I can't find the syntax to say "ok now show the fragment". 

OR if there is another way to access the type of a child issue that is more straightforward than this please let me know.

Any ideas? 


Issues.search("issuekey in childIssuesOf('$issue.key')").each { child ->
def childKey = child.key

def childType = child.issueType

log.warn "$childKey, $childType"

if ( jiraHelper.project?.key == "PTDEMO" || jiraHelper.project?.key == "MSPG" && childType.name in "Project Resources" && issue.issueType.name == "Initiative" && issue.status.name !in ["Created","Roadmap Item Triage","Roadmap Backlog","Will Not Do","Ready for Design","Design","Ready for Delivery","Delivery","QA Validation","Pending Release","GA/Shipped","Bugtail"]){

//display the fragment...

}

}



1 answer

Try 

return true 

return false :) 

I tried this and it isn't working. In the conditions section of fragments it says "Under what circumstances should this link be displayed. Must be either a plain script or an implementation of com.atlassian.plugin.web.Condition" 

Am I trying to do something that is just out of scope of fragment conditions? 



Issues
.search("issuekey in childIssuesOf('$issue.key')").each { child ->

def childKey = child.key

def childType = child.issueType

log.warn "$childKey, $childType"

if ( jiraHelper.project?.key == "PTDEMO" || jiraHelper.project?.key == "MSPG" && childType.name in "Project Resources" && issue.issueType.name == "Initiative" && issue.status.name !in ["Created","Roadmap Item Triage","Roadmap Backlog","Will Not Do","Ready for Design","Design","Ready for Delivery","Delivery","QA Validation","Pending Release","GA/Shipped","Bugtail"]){

return true

}

}

Suggest an answer

Log in or Sign up to answer