Overview

Gtmhub enables you to integrate with Jira in two ways. You can install the Gtmhub plugin for Jira Cloud or Server to link Jira issues to Gtmhub Objectives in the form of Tasks. You can also sync Jira data to Gtmhub and build powerful insights and automate your KRs. Check out this article to learn more about the use cases supported by these integrations.

If you want to query different Jira data and build complex insights, the recommended way is to sync your Jira data in Gtmhub. In some scenarios, you might want to automate your KR progress based just on the status of the Jira items you've linked to a Gtmhub Objective. Since this linking actually creates a corresponding Task under the specified Objective, you can actually use the Gtmhub Data Source to create your insights and automate your KRs. This article explains how to achieve this.

Create an insight using Gtmhub Tasks

Each Gtmhub account comes with a default data source called Gtmhub. This data source pulls data from your Gtmhub account and makes it available so you can build insights against it. It also powers the default Performance and Process reports (which are also insights, by the way). To see what data is available in your Gtmhub data source, check out Reference: Gtmhub data source. To build an insight based on the linked Jira items, we'll be using the GtmhubTasks and GtmhubGoals entities.

The Gtmhub data source has an entity called GtmhubTasks – it contains all Tasks in your account. Each Task has a field that indicates its status, its parent OKR (if one is selected) and if it comes from an external system, which external system it comes from (in this case Jira)

This way, you can build an SQL insight against the GtmhubTasks table and apply some logic that calculates the ratio between the number of Jira-linked Tasks in a certain status over the total number of Jira-linked Tasks under that Objective. To find the Objective Id, you will need to query the GtmhubGoals entity, which contains all Objectives in your account. Here’s a sample:

SELECT

CASE WHEN all_tasks = 0 THEN 0

ELSE

100*tasks_status_table.cmpl_tasks/tasks_status_table.all_tasks END AS progress

FROM

( SELECT

COUNT(id) AS all_tasks,

COUNT(1) FILTER (WHERE status = 'Done') as cmpl_tasks

FROM GtmhubTasks -- this is the table that holds all Tasks in your account

WHERE parentId IN --This is the ID of the Goal the tasks lives under. Can be replaced with dynamic filter

(

SELECT id FROM GtmhubGoals -- This table holds all Objectives

WHERE name = 'Seamless API integrations'

)

AND externalsystem = 'jira' -- tasks linked through the Jira plugin have this field set to 'jira'

) AS tasks_status_table

Additional information

Note that the above scenario is possible since you linked these items as Gtmhub Tasks using the Jira plugin. If you wanted to abstract from what you’re linking as Tasks in Gtmhub, and have other Jira content dynamically power your KR numbers, then you will need to sync the Jira data using the Jira Integration approach. This way you can build your insights directly against the Jira info that will be available to you as a result of this integration.

Did this answer your question?