can i use jjupin to validate if a link exists

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

3 answers

1 accepted

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)

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

Florin

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

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.

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.

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

86 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you