Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

hasLinks function stopped working

Bart Celary
Contributor
December 8, 2023

I am using a following saved filter:

issuetype=Feature OR (issuetype=Story AND (hasLinks != "is child of" OR hasLinks is EMPTY))

 This filters Feature type tickets and those Stories that have no parent of any kind. It used to work for me but appearantly something changed and now when I try to edit that filter, I get an error:

Field 'hasLinks' does not exist or you do not have permission to view it.

Strangely the saved filter appears to still be working, however incorrectly (not showing any Stories that should be found).

What could have changed? Could this be related to some Jira Cloud upstream change? Or maybe someone made some changes to my permissions?

I still see in the documentation of ScriptRunner that this is the right way to query.

I have also checked that I can go to the ScriptRunner enhanced search and everything works for me in there... Except the hasLinks thing.

2 answers

1 vote
Trudy Claspill
Community Champion
December 8, 2023

Hello @Bart Celary 

According to the documentation for ScriptRunner, the version for self-hosted included the hasLinks functionality but the version for Cloud does not. Reference

https://docs.adaptavist.com/sr4jc/latest/differences-between-scriptrunner-for-jira-server-and-jira-cloud/jql-query-comparison-with-scriptrunner-for-jira-server

https://docs.adaptavist.com/sr4jc/latest/features/scriptrunner-enhanced-search/jql-functions

https://docs.adaptavist.com/sr4jc/latest/features/scriptrunner-enhanced-search/jql-keywords

 

Which Scriptrunner documentation are you referencing? Perhaps you're looking at the documentation for the Jira DC version?

GL December 8, 2023

Please note the changes made in the August 2023 release notes here: https://docs.adaptavist.com/es/latest/release-notes

For example, you could use issueLinkType (which is provided by Atlassian here) in queries where you currently use hasLinks to search for issues based on the type of issue links you have.

Bart Celary
Contributor
December 11, 2023

Great Scott! Yes - reading release notes FTW! Thanks for the find, I will try some workarounds.

Bart Celary
Contributor
December 11, 2023

Unfortunately, it seems that it is not possible to obtain the same result using `issueLinkType`:

issuetype=Feature OR (issuetype=Story AND (issueLinkType != "is child of" OR issueLinkType is EMPTY))

 Unless I am doing something obviously wrong, this query shows me Stories that are child of Features.

Trudy Claspill
Community Champion
December 11, 2023

@Bart Celary 

If you look at the documentation I provided

https://docs.adaptavist.com/sr4jc/latest/differences-between-scriptrunner-for-jira-server-and-jira-cloud/jql-query-comparison-with-scriptrunner-for-jira-server

...you will see that it it recommends the use of a new keyword numberOfLinks

 

Screenshot 2023-12-11 at 7.49.30 AM.png

Bart Celary
Contributor
December 11, 2023

Thanks for the remark. I never considered this because it does not help with the command I am trying to replace after `hasLinks` was deprecated.

However, I have found a workaround suggested by my colleague.

Create a named filter (call it X):

issuetype=Story AND issueLinkType = "is child of"

 Use it as negation:

issuetype=Feature OR (issuetype=Story and filter!="X")

This is now filtering for issues that are either Features or Stories that have no parents.

0 votes
Remi DC December 11, 2023

Hello,

I had the same issue as Bart a few days ago.

Why is was working until now as the released is from march ? @GL 

Remi DC December 11, 2023

@Bart Celary 
I think I found what is the issue.
Unlike Atlassian documentation : https://support.atlassian.com/jira-software-cloud/docs/jql-fields/#Issue-link-type

1. You need to put the link name not the inward or outward to make it works.

2. You can use numberOfLinks = 0

See

project = NEXTG 
AND issuetype = Story
AND resolution = Unresolved
AND status not in (Open, "Spec Writing")
AND "Need Test Coverage[Radio Buttons]" = Yes
AND (issueFunction in linkedIssuesOf("issuetype = Test
AND status not in (done, Review,"Postponed")", "tests")
OR issueLinkType != test
OR numberOfLinks = 0)
AND ("BE Story points[Number]" is not empty OR "FE Story points[Number]" is not empty OR "Story Points[Number]" is not empty) ORDER BY status DESC
Remi DC December 11, 2023

Is seems from my test that :
issueLinkType with inward or outward description and negation (not in / !=) 

makes the jql function not working 
image.png

Bart Celary
Contributor
December 11, 2023

thanks - see the other thread for how we were able to solve it.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events