Find the last viewed date for dashboards and Agile boards in Jira (Server and Data Center)
Platform Notice: Data Center Only - This article only applies to Atlassian apps on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs 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
Obtain the last viewed dates of dashboards and Agile boards in Jira, to facilitate cleanup of unused dashboards, boards and filters.
Solution
The steps outlined on this article are provided AS-IS. This means we've had reports of them working for some customers — under certain circumstances — yet are not officially supported, nor can we guarantee they'll work for your specific scenario.
You may follow through and validate them on your own non-prod environments prior to production or fall back to supported alternatives if they don't work out.
We also invite you to reach out to our Community for matters that fall beyond Atlassian's scope of support!
The following read-only SQL query will list the dashboards in Jira along with their last viewed timestamps:
SELECT U.entitytype, U.entityid, P.pagename, U.username, to_timestamp(CAST(U.lastviewed AS BIGINT)/1000) AS "lastviewedtimestamp" FROM userhistoryitem U JOIN portalpage P ON U.entityid = cast(P.id as varchar) WHERE U.entitytype = 'Dashboard' ORDER BY U.lastviewed;The following read-only SQL query will list the Agile boards in Jira, along with their last viewed timestamps and the IDs of their saved filters:
SELECT U.entitytype, U.entityid, P."NAME" AS name, U.username, P."SAVED_FILTER_ID" AS filterid, to_timestamp(CAST(U.lastviewed AS BIGINT)/1000) AS "lastviewedtimestamp" FROM userhistoryitem U JOIN "AO_60DB71_RAPIDVIEW" P ON U.entityid = cast(P."ID" as varchar) WHERE U.entitytype = 'RapidView' ORDER BY U.lastviewed;The above queries have been tested using PostgreSQL, and may require some adjustment when run on other databases.
The contents of the userhistoryitem table are not guaranteed to be stored permanently, as described in our developer documentation: UserHistoryItem
As such, it may be useful to cross-check the results of the above queries against the full list of dashboards and Agile boards from the Jira REST API:
Was this helpful?