Background

When Jira datasync is on, there is special automated field used for the sync that stores the matching JiraID. The JiraID will be displayed on the details page for requirements and incidents - it is a special field that is auto-populated. But this field is not displayable normally on the list pages

The Jira ID is shown by default in a number of reports, but not all. For example, it is not visible in the incident section of the Test Case Traceability Report.

Solution

Displaying JiraID on the list pages

To display the JiraID on the list pages for Incident and Requirement artifacts, you need to create a new custom property:

1. Go to the Artifact -> Custom Property menu item
2. Create a Custom Property type Text

3. Set the appropriate name for the Custom Property - JiraIssueKey in this example above
4. Go to Data Synchronization menu under the Integration section of the Admin menu
5. Choose the Product for the current synchronization and click Navigate to the Artifact:

6. Click to the Custom Property created recently - JiraIssueKey
7. Set the External Key value to be exactly "JiraIssueKey" (which is a special word identifying JiraID)

8. Go to the Incident's or Requirement's list page 
9. Click on Show Columns dropdown and select JiraIssueKey column

Congratulations - you now have a JiraID displayed on the list page!

 

Displaying JiraDataSync ID in the Test Case Traceability Report

In this example, to include the JiraDataSync ID into the report, we will modify the existing XSLT code.

1. Clone the built-in Test Case Traceability report, give it a meaningful name
2. Click Edit to open the cloned report details page
3. Navigate to the Standard Sections
4. Click Customize to modify the standard Test Case Traceability grid

5. Copy below provided XSLT code and paste it into the Template section:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
  <xsl:template match="/TestCaseData">
    <table class="DataGrid" style="width:100%">
      <tr>
        <th>Test #</th>
        <th>Name</th>
        <th>Priority</th>
        <th>Releases</th>
        <th>Test Sets</th>
        <th>Incidents</th>
		<th>JiraDataSync ID</th>	
		</tr>
		
      <xsl:for-each select="TestCaseFolder">
        <tr>
          <td>
            <b>
              <xsl:value-of select="TestCaseFolderId"/>
            </b>
          </td>
          <td>
            <xsl:attribute name="style">
              padding-left: <xsl:value-of select="string-length(IndentLevel)*2"/>px;
            </xsl:attribute>
            <b>
              <xsl:value-of select="Name"/>
            </b>
          </td>
          <td></td>
          <td></td>
          <td></td>
          <td></td>
        </tr>
        <xsl:for-each select="TestCases/TestCase">
          <tr>
            <td>
              TC<xsl:value-of select="TestCaseId"/>
            </td>
            <td>
              <xsl:value-of select="Name"/>
            </td>
            <td>
              <xsl:value-of select="TestCasePriorityName"/>
            </td>
            <td>
              <xsl:for-each select="Releases/Release">
                <xsl:if test="position() > 1">
                  , RL<xsl:value-of select="ReleaseId"/>
				</xsl:if>
                <xsl:if test="position() = 1">
                  RL<xsl:value-of select="ReleaseId"/>
				</xsl:if>
              </xsl:for-each>
            </td>
            <td>
              <xsl:for-each select="TestSets/TestSet">
                <xsl:if test="position() > 1">
                  , TX<xsl:value-of select="TestSetId"/>
				</xsl:if>
                <xsl:if test="position() = 1">
                  TX<xsl:value-of select="TestSetId"/>
				</xsl:if>
              </xsl:for-each>
            </td>
            <td>
              <xsl:for-each select="Incidents/Incident">
                <xsl:if test="position() > 1">
                  , IN<xsl:value-of select="IncidentId"/>
				</xsl:if>
                <xsl:if test="position() = 1">
                  IN<xsl:value-of select="IncidentId"/>
				  <td>
				<xsl:value-of select="CustomProperties/CustomProperty[Name='JiraDataSync']/Value"/>
				  </td>
				</xsl:if>
				

              </xsl:for-each>
            </td>
          </tr>
        </xsl:for-each>
      </xsl:for-each>
    </table>
  </xsl:template>
</xsl:stylesheet>

6. Click Save twice

7. You should get the report similar to shown on the screenshot below:

Another approach to get the JiraDataSync ID is to extract it from the Custom Property (see section 1 of this article) created and mapped to the JiraIssueKey special token:

select 
R.TEST_CASE_ID AS TestCaseID, 
R.NAME As Name, 
R.TEST_CASE_PRIORITY_NAME AS Priority, 
TX.[TEST_SET_ID] AS TestSetID,
TCI.INCIDENT_ID AS IncidentID, 
INC.CUST_01 AS JiraDataSyncID
from SpiraTestEntities.R_TestCases as R 
INNER JOIN SpiraTestEntities.R_TestSetTestCases AS TX ON R.TEST_CASE_ID = TX.TEST_CASE_ID
INNER JOIN SpiraTestEntities.R_TestCaseIncidents AS TCI ON R.TEST_CASE_ID = TCI.TEST_CASE_ID
INNER JOIN SpiraTestEntities.R_Incidents AS INC ON TCI.INCIDENT_ID = INC.INCIDENT_ID
where R.PROJECT_ID = ${ProjectId}

In above SQL query CUST_01 considered as the ID of the Custom Property mapped to the Custom field that was created to replicate JiraID field.

After inserting query into the Custom Sections, do not forget to click on Create Default Template, give a name to the report and click Save twice.

 

Important Note: If you have two instances of Jira plugin configured, then Custom Property will get JiraID only for the active sync while JiraDataSync built-in field will show JiraID gathered from the first plugin.