Forums

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

How do I validate the issue type of a parent link?

Paddy Walsh
Contributor
June 21, 2023

I am using Jira Premium and I also have Jira Workflow Toolkit for workflow validation. I have created a new issue type called 'Problem' and I have added a Parent Link field to the Bug issue type. So when I create a bug I want to validate that the parent link points to a Problem issue type but I can't figure out how to do that with JWT?

Can anybody help?

1 answer

1 accepted

2 votes
Answer accepted
Vicente Domínguez _Decadis AG_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 22, 2023

Hello @Paddy Walsh,

I am Vicente, a member of the Support Team of Decadis, and I will gladly help you to configure a JWT for Jira Cloud Jira expression validator to evaluate if the Parent Link field links an issue of a certain issue type and the current issue.

In order to do so, please, add the following expression to the Jira expression validator after replacing nnnnn with the ID of the Parent Link field and 10619 with the ID of the Problem issue type.

issue?.customfield_nnnnn?.data.issueType.id == "10619"

 

Some more use cases for our Jira expression validator can be found in our documentation, namely in the page Jira expression condition/validator (use cases).

Please, let us know if you need further assistance in this thread or via our Support Service Desk.

Best regards,

Vicente

Paddy Walsh
Contributor
June 22, 2023

Hi @Vicente Domínguez _Decadis AG_ ,

Thanks very much for your prompt answer.

When I use your suggestion in JWT and run the expression against an existing Bug with the parent already set it works (evaluates to true). However, when I try to create a bug in Jira and I supply the Parent Link it fails. What could I be doing wrong?

Oddly, this only seems to happen on issue creation - if I apply the same expression to a later transition it seems to work.

I am also finding it very difficult to figure out how to access values in the linked issue (linked by the Parent Link field which is a Jira-specific custom field). You use the prefix issue?.customfield_10018.data but how do I know what is in this data? For example, how can I test the status of the linked issue or how would I check the value of a custom field in the linked issue?

I want to do something like:
issue?.customfield_10018.data.customfield_10197 != null
but this resolves to true no matter what the 10197 field is set to in the parent issue?

Vicente Domínguez _Decadis AG_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 23, 2023

Hello @Paddy Walsh

Apologies, but this value does not seem to be available during the creation of the issue. I tested it in other transitions and, as you mention, was working as expected. I assumed beforehand that the behavior was the same in all the transitions.

 

Regarding your second question, the properties of a field can be examined by running an expression like the following one in our expression editor:

issue?.customfield_10018

It would only be necessary to replace the ID 10018 with the appropriate one to adapt it for any other custom field.

In this case, data is one of the available properties of the field, and we made use of it in our previous expression.

 

For your purpose, as there are no “status” property available for the field, the constructor new Issue() must be used to retrieve more information about the issue of the Parent Link field:

 new Issue(issue?.customfield_10018.data.key).status.name == "In Progress"

 

If you are interested in which functionalities you would like to discover or see implemented in our app please feel free to open a ticket in our Support Service Desk.

Best regards,

Vicente

Like Paddy Walsh likes this
Paddy Walsh
Contributor
June 23, 2023

Hi @Vicente Domínguez _Decadis AG_ ,

Thanks very much - the new Issue seems to work - I assume it only create a temporary issue of some sort? I hope you don't mind if I ask one final question - if I use 'new Issue' can I perform several checks on that issue or would I need to do new Issue several times?

Vicente Domínguez _Decadis AG_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 23, 2023

Hello @Paddy Walsh ,

For not using the constructor several times, the issue can be stored in a variable and evaluated, for example, as follows:

let evalIssue = new Issue(issue?.customfield_10018.data.key);

evalIssue.status.name == "Done" && evalIssue.customfield_10197 != null

Please, let us know if you need some more information.

Best regards,

Vicente

Like # people like this
Paddy Walsh
Contributor
June 23, 2023

@Vicente Domínguez _Decadis AG_ 

Thanks very much Vicente - that is all working well now - you have been a great help.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events