Workflow condition to check if the issue has a link to a confluence page

quality-support May 9, 2017

I want to add an condition to a workflow transition to require the issue to have a link to a confluence page. 

I have ScriptRunner and Jira Workflow Toolbox installed. 

1 answer

1 accepted

1 vote
Answer accepted
Thanos Batagiannis _Adaptavist_
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.
May 10, 2017

Hi there,

So your condition should be something like 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.RemoteIssueLinkManager

ComponentAccessor.getComponent(RemoteIssueLinkManager).getRemoteIssueLinksForIssue(issue)?.find {it.applicationName == "Confluence"}

PS. I am not sure if the application name will be exactly confluence but you can easily find it out if you go to your  Application Links

regards, Thanos

quality-support May 11, 2017

I have implemented the script you show on a condition of a transition but I'm able to make the transition evan if I don't have any link. 

 

I have check the Application Link name and it "Confluence" 

 

Thanks for you help 

quality-support May 11, 2017

I change a bit of your script and now is working. 

 

This is the new version 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.RemoteIssueLinkManager

passesCondition = false
ComponentAccessor.getComponent(RemoteIssueLinkManager).getRemoteIssueLinksForIssue(issue)?.find {
    if(it.applicationName == "Confluence"){
        passesCondition = true
    }
}


Thank you for your help 

 

Best regards, 

Pedro Felgueiras

Suggest an answer

Log in or Sign up to answer