Within Jira Service Management, a linked KB to Confluence that doesn't exist cannot be deleted.
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Within Jira Service Management a Confluence Knowledge Base that is inaccessible or missing, the Knowledge Base link will not be able to be broken. This may happen if a Jira project is migrated via Configuration Manager for Jira for example from one instance to another where the Confluence link is not accessible.
Environment
Jira Service Management 5
Diagnosis
When trying to unlink/delete the Knowledge Base within JSM, user will see an error in the user interface stating "We couldn't unlink the [space name] space. Refresh the page and try again. If this keeps happening, contact your Jira admin.". Within the atlassian-jira.log the following error may be present:
https-openssl-nio-443-exec-26 url: /rest/servicedesk/knowledgebase/1/articles/search-limit; user: [username] ERROR [username] 999x164878x2 uvubi9 7.20.53.159 /rest/servicedesk/knowledgebase/articles/search-limit [c.a.p.r.c.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: null
java.util.NoSuchElementException
Solution
In events like this the Knowledge Base can be manually deleted via the database using the following procedure:
- First get the Service Desk project ID:
select p.pname, sd."ID" as "sd_id" from public."AO_54307E_SERVICEDESK" sd inner join project p on p.id = sd."PROJECT_ID";
- You may need to delete content from a few tables with key constraints (these tables may also not have any content depending on how the KB Space was used. But if there data in these tables it needs to be cleared out). We will use the "sd_id" column returned in the first query to run the following delete statements:
delete from public."AO_54307E_CONFLUENCEKBENABLED" where "SERVICE_DESK_ID" = <sd_id>;
delete from public."AO_54307E_CONFLUENCEKBLABELS" where "SERVICE_DESK_ID" = <sd_id>;
- Finally you will use the "sd_id" column returned in the first query to run the following delete statement to remove the KB link:
delete from public."AO_54307E_CONFLUENCEKB" where "SERVICE_DESK_ID" = <sd_id>;
- After completing this step, refresh the page to ensure that the space has been unlinked. If the space is still present, restart Jira. This should remove the Knowledge Base from the project.
NOTE: When performing manual database modification it is critical to ensure that there is a database back up in case a rollback is needed.