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,558,009
Community Members
 
Community Events
184
Community Groups

Script Behaviour - How to limit issue picker filed on form to show only current issue linked issues?

Hi,

i wanted to show only the issues which are linked to the current issue form (i use issue picker field on the form).  Can anyone help me on this.

 

many Thakns

Harish Kumar

1 answer

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Apr 22, 2021 • edited

Hi @Harish Kumar

If you intend to use the Behaviour to filter out your Issue Picker for linked issues, you will first need to create an Issue Picker scripted field as shown in the images below:-

image1.png

image2.png

Configure the field and add a basic JQL Query for it.

 

Next, you will need to add a Behaviour configuration. For this, you will need to use the Behaviour Initialiser.

Below is a print screen of the Behaviour configuration:-

image3.png

 

Below is an example working code for your reference.

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript

@BaseScript FieldBehaviours behaviours

def testPicker = getFieldByName("Test Picker")

def issueLinkManager = ComponentAccessor.issueLinkManager
testPicker.hidden = true

if(underlyingIssue!=null) {

def outwardLinks = issueLinkManager.getOutwardLinks(underlyingIssue.id)
def inwardLinks = issueLinkManager.getInwardLinks(underlyingIssue.id)

if(outwardLinks && inwardLinks) {
testPicker.hidden=false

outwardLinks.each {
testPicker.setConfigParam("currentJql", "project = ${issueContext.projectObject.key} and key in (${it.sourceObject.key}, ${it.destinationObject.key}) and issueFunction in hasLinks('is blocked by')" )
}

} else if(outwardLinks) {
testPicker.hidden=false
outwardLinks.each {
testPicker.setConfigParam("currentJql", "project = ${issueContext.projectObject.key} and key = ${underlyingIssue.key} and issueFunction in hasLinks('is blocked by')" )
}

} else if(inwardLinks) {
testPicker.hidden=false
inwardLinks.each {
testPicker.setConfigParam("currentJql", "project = ${issueContext.projectObject.key} and key = ${it.sourceObject.key} and issueFunction in hasLinks('blocks')" )
}

}
}

Please note, this sample code is not 100% exact to your environment. Hence, you will need to make the required modifications.

The behaviour can only work once the Issue has been created, and it cannot work on the Create Screen.

Below is a test example:-

image4.png

 In this sample, the issue IPL-1 has two blocked issues, i.e. IPL-2 and IPL-3. 

So, when the IPL-1 issue is being edited, only the issue(s) that it blocks, i.e. IPL-2 and IPL-3, are available for selection in the issue picker. Other issues are filtered. Below is a print screen for your reference:-

image5.png

I hope this helps to solve your question. :)

 

Thank you and Kind Regards,

Ram

Hi Ram @Ram Kumar Aravindakshan _Adaptavist_ ,

My query for issue is picker is bit different.

on the current issue if i edit the issue the issue picker field needs to filter the issues in such a way that. it goes to the current epic link and list out all the issues with a certain issuetype into m current issue.

Many Thanks

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events