Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

Recognition

  • Give kudos
  • My kudos

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

How to validate that a linked issue has been entered on creating an issue?

When a user (service desk agent) creates an issue, I have included the 'linked issues' field in the create screen.  I want to make sure that the user has entered at least one issue in this field.

I am running JIRA Cloud, and have Scriptrunner available.

I have tried making the field mandatory in the field configuration scheme, but I think this only enforces the link type.

I have tried to set a validator in the workflow - 'Field Required Validator' but there is no 'linked issues' field in the list of possible fields.

I have tried to write a 'Scriptrunner script validator' in the workflow.  I have used this expression: (issueLinkManager.getOutwardLinks(issue.id).length) ? true : false

... but this always returns false.

Can anyone help please?

 

1 answer

1 accepted

0 votes
Answer accepted

Hi Nick,

Thank you for your question.

I can confirm that we have created the Knowledge Base article located here which explains how Script Validators work inside of ScriptRunner for Jira Cloud. 

You will see in the Knowledgebase articlle that it shows that validators are defined using the Jira Expression Framework as documented in the Atlassian API documentation page located here.

We can confirm that when viewing the Jira Expression Framework API documentation page linked above you can navigate to the Context variables section which shows what variables are provided by this framework that can be used to create the expression. 

If you then click on one of the variables it will show all the properties that can be called on the variable for the expression such as for the issue variable.

I can confirm when reviewing the properties available to the issue variable one of the properties as described in the API documentation is the links property which contain the issue links for the issue and this is the property that you should look to check in your validator. 

I hope this information helps.

Regards,

Kristian

Thanks - I hadn't found that documentation anywhere - it makes sense now.  So here's what works:

(issue.links.length) ? true : false

Easy when you have the documentation!

Hi Nick,

Thank you for confirming that you have resolved your issue.

I can also confirm that I have come up with an alternative way to validate than an issue has at least one linked issue which is shown here and wanted to share this with you as well as a reference.

Regards,

Kristian

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Asked in Jira Service Desk

Calling all Insight users, we need your help!

Hello Insight users,  As part of our (Mindville's) acquisition by Atlassian, our training team is looking to build some new Insight training materials. It would really helpful if you can ...

218 views 3 4
View question

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