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

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

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

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 

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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,770 views 11 18
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot