import com.atlassian.applinks.api.ApplicationLinkService import com.atlassian.applinks.api.application.confluence.ConfluenceApplicationType import com.atlassian.jira.bc.issue.link.RemoteIssueLinkService import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.link.RemoteIssueLink import com.atlassian.jira.user.ApplicationUser import org.apache.log4j.Logger static boolean hasAnyRemoteConfluenceLink(ApplicationUser user, Issue issue, Logger log = null) { def applicationLinkService = ComponentAccessor.getComponent(ApplicationLinkService) def remoteIssueLinkService = ComponentAccessor.getComponent(RemoteIssueLinkService) def conf_link = applicationLinkService.getApplicationLinks(ConfluenceApplicationType)?.first() if (!conf_link) { log?.error "No confluence application link found." return false } return remoteIssueLinkService.getRemoteIssueLinksForIssue(user, issue)?.remoteIssueLinks?.any{it.applicationType == RemoteIssueLink.APPLICATION_TYPE_CONFLUENCE} } hasAnyRemoteConfluenceLink(ComponentAccessor.jiraAuthenticationContext?.loggedInUser, issue)
I want to verify that at least one confluence page is linked.
wiki page link.png
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tej, did you manage to do this? Would be grateful if you could share an updated script !
Thanks :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What exactly do you want to validate? Response from Confluence or that it's a link?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.