Updating Jira serverID and Jira ServerName in Jira issues in Confluence

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

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

In some scenarios, Jira server/DC will get migrated to different instances or migrate to the Jira cloud or vice versa. In such cases, configured Jira issues in Confluence will not display the results. This is because Jira metadata like Jira serverID and Jira serverName in the Jira issue filter will not be able to connect to the same Jira server from where these metadata are fetched. 

Environment

Confluence

Jira

Cause

When Confluence makes a connection with other applications like Jira using the Jira issue filter macro, it fetches the destination application metadata, for example ( ServerId & ServerName ). Here is an example of one of the Jira issue code snippets from the page storage format:

    <ac:structured-macro ac:macro-id="9325964b-61c2-45e6-979c-0fa8365c6901" ac:name="jira" ac:schema-version="1">
      <ac:parameter ac:name="server">SAP Projects</ac:parameter>
      <ac:parameter ac:name="serverId">1e9faecf-27de-35b4-9422-9d9d1169451f</ac:parameter>
      <ac:parameter ac:name="key">CE-4704</ac:parameter>
    </ac:structured-macro> → Assign Follow-up/Related Items to an email</li>

Here "1e9faecf-27de-35b4-9422-9d9d1169451f" is the serverID and SAP Projects is the ServerName. These values can be validated with the application Link detail:

    <application-links>
      <id>92470b9e-cf72-375e-b312-cdf19f545a56</id>
      <name>JIRA</name>
      <primary>true</primary>
      <type>applinks.jira</type>
      <display-url>https://testjira.com/jira</display-url>
      <rpc-url>https://testjira.com/jira</rpc-url>
    </application-links>
  </application-links>

As both IDs are mismatching that means Confluence has a Jira app link connected to the latest Jira server after Jira server migration. But Confluence pages are still pointing to the old Jira server using the old Jira serverID and Jira server Name. With this mismatch, we started seeing the following error in the Confluence page with the Jira application link. 

Solution

To fix this issue we have 2 different options,

Option 1:- Install Confluence Source Editor in your Local Confluence Instance and follow the below steps to update the serverid in the Page body,

  • Install Confluence Source Editor.
  • After installation, Go to the affected page and edit the page.
  • This will open one page and top right corner you will see <> option.
  • Click on <> and it will open another page that contains the page Body.
  • Here search the Old ServerID and replace it with ServerID copied from the APP link Configuration. You will get the APP link configuration from Support Zip, Application.xml file. 
  • Publish the page and see if you are able to see the Jira Issue link properly.

Option 2:- With this option, we will execute the SQL Update statement to update the server-id in the database itself.

  • Stop Confluence following standard procedure.

     Create a database backup before changing anything. Additionally, any database modifications should be done while Confluence is shut down and not running.

  • Run the below SQL statement to update the body content,

     You may need to adjust the SQL statement to work with your specific database engine.

    update BODYCONTENT
    set body = replace(body, '<OldServerID>', '<NewServerID>')
    where body like '%<Old ServerID>%';
    commit;

    For updating serverName

    update BODYCONTENT
    set body = replace(body, '<Old ServerName>', '<New Server Name>')
    where body like '%<Old ServerID>%'  ;
    commit;

    For updating these detail specific to one particular Space:

    update BODYCONTENT
    set body = replace(body, '498c2bc8-7a9d-38d5-b053-d0bfaa113b98', '07e13224-8bba-3d8d-8b2e-db105ad7eb19')
    where contentid in (select CONTENTID from content where spaceid='<SPACEID>' and contenttype='PAGE';)
    and body like '%498c2bc8-7a9d-38d5-b053-d0bfaa113b98%'  ;
    commit;
    
    update BODYCONTENT
    set body = replace(body, '>System JIRA<', '>Moxion JIRA<')
    where contentid in (select CONTENTID from content where spaceid='<SPACEID>' and contenttype='PAGE';)
    and body like '%>System JIRA<%'  ;
    commit;
  • Restart Confluence, 



Last modified on Oct 13, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.