It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Need help on making issue link mandatory on create and edit (if there is not links present already)


I am very new to scripting. I have a requirement to set Issue linking mandatory while creating an issue.
I have to set Linked issues to "is part of" (inward link) and also in issues field, it should only show tickets from that same project only.

However to make it mandatory I used behavior and added below code.

getFieldById("issuelinks-linktype").setFormValue("is part of").setReadOnly(true)

for some part, it is working fine. It is making issue linking mandatory while creating the issue also link type is set to "Is part of"

But the main problem is whenever I am trying to edit one issue, at that time even if there is already an existing link it is again asking to fill in the linking issue-issue filed.

and is it possible to show issue from the same project only in that issue filed?

any help would be highly appreciable. 

2 answers

2 accepted

1 vote
Answer accepted

Hi @Durga prasad panda 

Start with this piece of code.

import com.atlassian.jira.component.ComponentAccessor

def links = getFieldById('issuelinks')
def linksValue = links.getValue()
def linkType = getFieldById("issuelinks-linktype")
def linkTypeValue = linkType.getValue()
def linkField = getFieldById('issuelinks-issues')
def linkFieldValue = linkField.getValue()

def existingLinks = ComponentAccessor.getIssueLinkManager().getInwardLinks(underlyingIssue?.getId())

if (existingLinks?.size() == 0 && linkTypeValue == "is part of") {


} else {



It should make the link field required on creation and on edit later when there are no existing links but the code will not work when user clicks on the link option under the more or in the link section, for that you will have to write your own JavaScript.


Hi @Ravi_Sagar__Adaptavist_ 

Is there way to restrict which issues from which project/same project can be selected only in the linked issue?

by the way thanks the above solution worked like charm

0 votes
Answer accepted

Use the behaviour's Guide Workflow
Add a new condition of workflow action of Create (1) for the field

Thanks @Amit Girme for the reply. It is also working but the only thing is it is not checking for the links in the edit field. :)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

Keep your team in the loop with Team @mentions in Jira Software!

Hi everyone! My name is Jenny, a Product Manager at Atlassian. After launching Team @mentions in Confluence, we heard a lot of positive feedback from customers that they love how easy it is to @men...

226 views 4 12
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you