can i use jjupin to validate if a link exists

jim blizzard November 25, 2012

I want to be able to validate if a link exists on an issue as a condition of workflow

3 answers

1 accepted

0 votes
Answer accepted
Florin Manaila
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.
November 25, 2012

Oh, I see now.

Yes, it is possible using JQL like this (this is the SIL code that when used in a condition will do just what you want):

string [] linkedIssues = selectIssues("issue in linkedIssues(\" " + key + " \") ");
if(size(linkedIssues) == 0){
    return false;
}
return true;

Additionally, we have a specialized routine in our roadmap that will do: getLinkedIssues(parent, issueLinkType)

jim blizzard November 25, 2012

Thanks.. I will try this out shortly and let you know if I have any issues/questions.

jim blizzard November 25, 2012

Florin

I've tried this and it always returns false. What might I be doing wrong?

Florin Manaila
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.
November 25, 2012

My bad! I accidentally added an empty space before and after the key which resulted in the JQL being "issue in linkedIssues("<space><KEY><space>")".

The correct form is

selectIssues("issue in linkedIssues(\"" + key + "\") ");

.. note the removed spaces

Sorry about that.

1 vote
Florin Manaila
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.
November 25, 2012

Hi Jim,

It's not really clear to me what you are trying to accomplish here. You want to see if a condition in the workflow is fulfilled (which would mean that there is a specific transition available as a button on the issue) ? Where would you like to do this check? In a post-function? Listener? Service? Gadget? Please give us more details about the problem you are trying to solve.

Regards,

Florin Manaila.

0 votes
jim blizzard November 25, 2012

Thanks Florin

In a pre-condition (or validation) I want to NOT allow users to see/use the transition button if there is ZERO linked issues. I cannot use subtasks because this pre-condiation may be applied to subtasks as well. Hopefully that helps.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events