Hi
I want to create a custom field to display the number of issue links of an issue. How should i do that ?
Thanks
You can create a Script Runner Scripted Field.The script for the field will look like:
import com.atlassian.jira.component.ComponentAccessor a = ComponentAccessor.getIssueLinkManager().getLinkCollection(issue, issue.reporter).getAllIssues().size() a.toString()
More info on scripted fields:
https://jamieechlin.atlassian.net/wiki/display/GRV/Scripted+Fields
Hi Thuy Mai,
Try Database Value plugin and select count(*) fromissuelink.
select
*)
from
issuelink.
I think its little bit closer to your requirement.
Cheers
Try Database Value plugin and select count(*) from issuelink whereSOURCE=(selectid fromjiraissue wherepkey='<span>${</span><span>jira</span><span>.</span><span>issue</span><span>.</span><span>key</span><span>}</span>')
issuelink
where
SOURCE=(
id
jiraissue
pkey=
'<span>${</span><span>jira</span><span>.</span><span>issue</span><span>.</span><span>key</span><span>}</span>'
)
or
https://answers.atlassian.com/questions/215718/scripted-field-to-return-number-of-cloned-issues-not-workingscripted field will help you most rather than DB value plugin.
Thanks for your suggestion. I gave it a try but it does not work. Could you please help provide more detail steps ? Sorry i'm new to Jira
Which part did not work ?
Is the field shown with wrong value or it is not there at all ?
It works now. Thanks
Hi Boris, I needed to count specific type of linked issues. Ex:- issue has 2 type of linked issues, 2 linked as blocks and 2 linked as clone. How can i get these separately. Current answer is 4, but i need 2
Worked with a slight modification of Boris script:
import com.atlassian.jira.component.ComponentAccessordef CountLink = ComponentAccessor.getIssueLinkManager().getLinkCollection(issue, issue.reporter).getAllIssues().size()CountLink.toString()
Amazing, thank you
Hi @Philippe Puy ,
I faced a problem for this script. Do you know how to count the number of linked issues base on linked issues type? Thank you very much!
Hi - does anyone have a script sample for the cloud version? Thanks!
It looks like you're new here. Sign in or register to get started.