Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can we require an Issue to have Confluence article linked to it before it can be resolved

Matt Baker
Contributor
August 28, 2023

Is there way that we could not allow JSM agents to resolve an issue without first having the issue linked to a Confluence article?

 

2 answers

0 votes
Oliver Siebenmarck _Polymetis Apps_
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.
August 29, 2023

Hi @Matt Baker ,

This is an interesting one, as there is no easy way to find links to Confluence pages with Jira Expressions. The documentation certainly does not list any. 

But we do get the change logs to an issue with Jira Expressions, so there might be a way. In any case, you will need an app that supports expressions-based conditions. Personally, I like this one, mainly because I work for Polymetis Apps.

So, let's get to it. We cannot get the link to Confluence directly, as

issue.links 

only contains links to actual issues. But fortunately, there is the change log, which contains an entry for when a Confluence page is linked. That is available in 

issue.changelogs

The data in there is structured like this:

[
{
"id": "123456789",
"author": {
"accountId": "123456456456456",
"emailAddress": "oliver.siebenmarck@jodocus.io",
"displayName": "Oliver Siebenmarck",
"active": true,
"timeZone": "Europe/Berlin",
"accountType": "atlassian"
},
"created": "2023-08-29T14:17:36.361+0200",
"items": [
{
"field": "RemoteIssueLink",
"fieldtype": "jira",
"from": null,
"fromString": null,
"to": "11111",
"toString": "This issue links to \"Wiki Page (System Confluence)\""
}
]
}

I've tried a few things, but it seems that the field "RemoteIssueLink" seems to be fairly reliable as an indicator for a link to Confluence being set up. I'd be comfortable using it, but would check in regular intervals, if there are exemptions to that rule to be found. 

Now that we found an indicator to test for, we can filter the change log for it and count if it occurs like this:

TL;DR: Try this expression:

issue.changelogs.filter(l => l.items[0].field == "RemoteIssueLink").length > 0

Hope that helps,
 Oliver

0 votes
Mark Segall
Community Champion
August 28, 2023

Hi @Matt Baker 

I don't know of any validators that work with Confluence.  However, you could do something like this:

  • Use a field to track whether kb article has been attached
  • Create a validator one the resolved transition where the above field cannot be empty
  • Leverage automation to set the field when the article is attached

For the automation it could work like this:

  • TRIGGER: Comment added
  • CONDITION (Advanced)
    • {{comment.body}}
      contains
      YourSpaceKey-
  • ACTION: Edit Issue (Field created above)
    • Some value to satisfy the validator
Matt Baker
Contributor
August 29, 2023

That’s good, but I was hoping to have the agents actually link the article to the issue. That way when we look at the article in Confluence we can see how many issues it has been linked to. 
Adding the article in a comment doesn’t create a link between that issue an the Confluence article. 
When I mention a Jira issue in a Confluence page it creates a link in the Jira issue. Seems strange that it doesn’t work the other way around, or am I missing something. 

Mark Segall
Community Champion
August 29, 2023

Unfortunately, there is currently no native capability to detect that a Confluence page has been linked.  That's why I proposed using the article share capability because that at least comes up in a comment. 

You may want to look at the API documentation to see if there's a way that you can check if the issue has any linked Confluence pages.  If there is, you could do something like this for the automation component:

  • TRIGGER: Issue Updated
  • CONDITION: Your custom field is empty
  • ACTION: Send Web Request
  • CONDITION: (Advanced)
    • {{webResponse.body.x}}
      Equals
      <response that link is there>
  • ACTION: Edit Issue (Your custom field)
    • Some response to satisfy the validator

I did a little research through the API documentation but wasn't able to find anything. However, I'll admit the API is not my strong suit so maybe something is there.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events