How to get a list of tickets excluding those with 0 elapsed time ?

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問


プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

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.

*Fisheye および Crucible は除く

要約


While using Jira Service Management reports, average of SLA is calculated based on total elapsed time of all tickets divided by the number of tickets. However there could be possibility where some tickets have 0 elapsed time, it could be because of different request type. Thus these tickets can impact the report and users might not want to include these tickets with 0 elapsed time. In this article we are going to discuss how we can get a list of tickets excluding 0 elapsed time. 

環境

JSM 4.x

診断

We can easily get elapsed time of an SLA field in millisecond for any Jira Service Management ticket with these two steps.

  • With follow SQL query we would be able to identify associated CUSTOMFIELD for the specific SLA field.
SELECT * FROM CUSTOMFIELD c WHERE c.CFNAME = 'Time to first response';
ID   |CFKEY|CUSTOMFIELDTYPEKEY                    |CUSTOMFIELDSEARCHERKEY                         |CFNAME                |DESCRIPTION                                              |DEFAULTVALUE|FIELDTYPE|PROJECT|ISSUETYPE|ISSUESWITHVALUE|LASTVALUEUPDATE|
-----+-----+--------------------------------------+-----------------------------------------------+----------------------+---------------------------------------------------------+------------+---------+-------+---------+---------------+---------------+
10225|     |com.atlassian.servicedesk:sd-sla-field|com.atlassian.servicedesk:sd-sla-field-searcher|Time to first response|This custom field was created by Jira Service Management.|            |         |       |         |               |               |
  • With following REST API, we can get the elpasedTime in millisecond for the particular ticket. Here you would have to replace ITSM1-6 with ticket-id and customfield_10225 with the ID of customfield, we got in last SQL query.
curl -su "username:password" "http://IP:PORT/rest/api/2/issue/ITSM1-6?fields=customfield_10225" | jq '.fields.customfield_10225.completedCycles[].elapsedTime.millis'
37743


ソリューション

  • This query will provide the list of tickets in project ITSM1 having SLA 'Time to first response' with elapsedTime not 0. User would have to replace ITSM1 with their project-key. 


SELECT ( p.pkey 
         || '-' 
         || i.issuenum ) AS issuekey, 
       cf.cfname AS FIELD , 
       cv.textvalue 
FROM   customfield cf, 
       customfieldvalue cv, 
       jiraissue i, 
       project p 
WHERE  i.project = p.id 
       AND cv.issue = i.id 
       AND cv.customfield = cf.id 
       AND cf.CFNAME = 'Time to first response' 
       AND p.pkey = 'ITSM1'
       AND cv.TEXTVALUE  NOT LIKE '%"elapsedTime":0%' 
       AND cv.TEXTVALUE LIKE '%elapsedTime%';



最終更新日 2022 年 6 月 15 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.