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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

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

Hi @Kristian Walker _Adaptavist_ ,

I can't seem to open the bitbucket URL, could you please post the snippet? I am trying to validate a specific issue link at creation, but it seems to be empty even when issue link is selected(I assume the issue is not created yet thus having no IssueLink object).

For everyone having the issue, workaround would be creating the issue and having post function on create that would transition the issue forward if the conditions are met(You would need additional status on beginning). :)

 

Regards,

Duje

Hi Duje,

I have just tested the URL and can confirm it works as expected.

Unfortunately, I can not share the content of the snippet here and it can only be accessed using the URL linked above.

I can, however, confirm that you can view examples for validators in our documentation site here.

As for validating a specific issue type then I can confirm that this is possible and as mentioned above you will need to review the Jira Expression Framework and the issuelinktype property that it provides to see how to check against the name of a link type.

Regards,

Kristian

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

Why upgrade to Jira Service Management Premium?

We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan.  &nb...

196 views 1 6
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