Forums

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

How to get "Linked Issue" field value in validator before creation in Jira plugin?

Flex Grigorovizch July 21, 2023

I have jira plugin with validator which must check that "Linked Issue" field on creation transition. On this transition IssueLink is not already existed and interface Issue have not default method to get this field.
Do we have other options to get this value?

 

UPD: answer is found and pinned

2 answers

1 accepted

0 votes
Answer accepted
Flex Grigorovizch July 24, 2023

If you want to validate this filed on "before creation" trasition you can use 

 

Map<String, String[]> map = ActionContext.getRequest().getParameterMap();
String[] issueLinkTypes = map.get("issuelinks-type");

You can find needful param which goes from frontend in this map.

0 votes
Hieu
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.
July 23, 2023

Hi @Flex Grigorovizch 

The class can use: 

ComponentAccessor.getIssueLinkManager()
refer docs: IssueLinkManager 
2 method can help you check are:
ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId())
And
ComponentAccessor.getIssueLinkManager().getInwardLinks(issue.getId())

Both methods above return a list of IssueLink , from this list you need to perform to do some filter and check to archive your purpose.


Flex Grigorovizch July 23, 2023

I wrote in question's description that on this stage IssueLink is not existed. It created after validator work

Hieu
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.
July 23, 2023

IssueLinkTypeService 

getIssueLinkTypes

 

This method return all IssueLinkType in current jira instance
-> perform check -> if your issue link already available -> continue your business code
if dont have the result -> using method to create

createIssueLinkType

 then continue your business code

Flex Grigorovizch July 23, 2023

I don't need to creat it programmatically. 

If I don't have the result I want to check is any values were filled on Create Form.

I.e. on creation stage issue also doesn't have "Id" field, because it filled after creation and I do not have to filled it by myself.

Hieu
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.
July 23, 2023

I have jira plugin with validator which must check that "Linked Issue" field on creation transition.

The solution I propose for plugin customization. If without programming, hope other members of community can help you.

Regards,

Flex Grigorovizch July 23, 2023

I'm doing in Jira Plugin on Java

Flex Grigorovizch July 23, 2023

I said you that the main problem that on transition before Issue creation. IssueLink is not already created and IssueLinkManager will return null value. I want to know is existed another options to get this value, may be I can get it from http request, or something esle

Hieu
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.
July 23, 2023

Let's simplify that.

In the UI, if you want to Link an issue. You need to browse the ticket first. Then you can link the issue using issue link.

The same in plugin, ticket creation process first then from the creation result -> perform link ticket.


Flex Grigorovizch July 23, 2023

I need to validate that linked issue is filled on creation stage. 

And if it field is not filled ticket must not create

Suggest an answer

Log in or Sign up to answer