Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Script runner -- questions about issue link validation within workflow transitions.

Hi all,

Had a couple questions with script runner. I know (and use) transition validation scripts like the example below:


..but how can I require that the link also be limited to a specific issue type? Such as 'Bug'?

My other question is that I've noticed that the transition validation example above works fine if the link is set earlier in the workflow. *However* -- if the transition that has the validation script also has a transition screen with an issue link field, and the user uses that field, the validation script doesn't notice it, and prevents progression in the workflow. Ideally I'd like to make it so the user can add the required field if necessary with in the transition screen itself without backing out and trying the transition again.

Would the solution be to set up a behavior? Guessing I could use same validation script above?

Any tips appreciated!!

1 answer

You can get the issuetype of the linked issue like this

issueLink is one entry of the list you get from getOutwardLinks().

For your second question look here:


How to validate a confluence link? 

Not sure what you mean by "validate", but you can get those links via the RemoteIssueLinkService. E.g.

remoteIssueLinkService.getRemoteIssueLinksForIssue(user, issue)?.remoteIssueLinks

to get all remote issue links of an issue.


I want to check at least one confluence page is linked to an issue wiki page link.png

If you know the pageid of the Confluence page (–> select Page Information menu item and take a look at the URL) you could use following method.

boolean hasRemoteConfluenceLink(ApplicationUser user, Issue issue, String pageId, Logger log = null) {
    def conf_link = applicationLinkService.getApplicationLinks(ConfluenceApplicationType)?.first()
    if (!conf_link) {
        log?.error "No confluence application link found."
        return false
    def globalId = "appId=$$pageId"
    return remoteIssueLinkService.getRemoteIssueLinksForIssue(user, issue)?.remoteIssueLinks?.globalId?.contains(globalId)


Thank a lot for response, 

But I want a global script just asking for a link of confluence or web link.

Is there any other way like below script... so that it throws an error and should ask for the link.

because we just can't do every confluence page id and keep on updating the script.



Yes, if you take a look into the API you could see there are some methods to get information from a RemoteIssueLink, e.g. getApplicationType() which should return "com.atlassian.confluence" (or better RemoteIssueLink.APPLICATION_TYPE_CONFLUENCE) for confluence links. Using this the method from above could be adapted to check for any Confluence link.

import com.atlassian.applinks.api.ApplicationLinkService
import com.atlassian.applinks.api.application.confluence.ConfluenceApplicationType
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
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)

(Not tested, take care of this by yourself. Please be aware that this takes the current user into consideration and what this user is able to see.)


Like Marina_M likes this



I'm trying to find a script that returns the a confluence link if contain 'closure report'.

Could this script be adapted todo this?


Many Thanks


Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

Learn how to request and manage app requests in the Marketplace

G’day everyone! Super exciting news coming from the Marketplace. We have now fully rolled out the ability for end-users to submit app requests to admins directly from within the product! No longer ...

43 views 1 5
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you