Dependent Counter Scripted Field not displayed as custom field in issue

I was tesing out some examples for Dependent Counter fields in JIRA from I copy pasted some scripts into the scripted field column and saved it.

But the dependent counter custom field doesnt appear on my issue page.

Am I missing out on some step?

4 answers

0 vote

Have you associated it with the issue type? Is it on the view issue screen? Check with the "where's my field" thing.

Also check the logs to make sure it's not failing.

Hi Jamie,

Yea you are right, I hadnt linked it with the screen..


I was trying to get this script to run but its not displaying the right value. I want to display the number of cloned links in a issue. BUt when I run this script I always get 1.

import com.atlassian.jira.component.ComponentAccessor



ComponentAccessor componentAccessor= ComponentAccessor.newInstance()

Collection<IssueLinkType> issueLinkTypes=componentAccessor.getComponentOfType(IssueLinkTypeManager.class).getIssueLinkTypes();

count = 0;

for (IssueLinkType linktype : issueLinkTypes) {

    String name=linktype.getName();





return count;

hello Shweta,

you are getting count as 1 because you are checking for number of link types with name Cloners in your jira. Probably it always return 1

As prasad suggested, you need to get links from the issue as

import com.atlassian.jira.component.ComponentAccessor;

IssueLinkManager issueLinkManager = ComponentAccessor.getIssueLinkManager();

List<IssueLink> issueInwardLinksList = issueLinkManager.getInwardLinks(issue.getId());

int inCount=0;

for(IssueLink issueLink : issueInwardLinksList)
	if(issueLink != null && issueLink.getIssueLinkType().getName().equals("Cloners"))

List<IssueLink> issueOutwardLinksList = issueLinkManager.getOutwardLinks(issue.getId());

int outCount=0;

for(IssueLink issueLink : issueOutwardLinksList)
	if(issueLink != null && issueLink.getIssueLinkType().getName().equals("Cloners"))
int totalCount=inCount+outCount;
return totalCount;

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Wednesday in Jira

Join our webinar: How 1B+ feature flag events helped us build the new Jira

Every time you release software, there's a bit of risk – that there's a bug, that something breaks, or that the feature doesn't resonate with customers. Feature flagging helps make high stakes s...

93 views 0 1
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you