メインコンテンツへスキップ

Accessing Custom Fields

DPQL Referenceで
作成者一覧
公開日: 2018年3月23日|最終更新日: 2022年11月3日

Several content types in Deskpro, including tickets and articles, support custom fields. You can access these fields in custom reports using the following syntax.

Each custom field has an ID number. Once you have the ID, you can reference the value of a particular field via custom_data[#]. For example, to refer to a custom ticket field with ID number 12, you would use tickets.custom_data[12].

Warning


If you are trying to retrieve a large number of fields, (over about 55), limitations in the underlying MySQL database will cause the query to fail with a “There is something wrong with your query” message. This is only likely to be an issue if you have a lot of custom fields. You can work around this limitation by retrieving data with the  API Basics

This query will give a count of all tickets created this month per value for the custom field with ID 12:

SELECT DPQL_COUNT() AS 'Total Tickets' FROM tickets WHERE tickets.date_created = %THIS_MONTH% GROUP BY tickets.custom_data[12]
copy

This will list the tickets created this month, split by the values of the custom field with ID 12:

SELECT tickets.id, tickets.subject, tickets.person FROM tickets WHERE tickets.date_created = %THIS_MONTH% SPLIT BY tickets.custom_data[12]
copy

This will list a count of the tickets which have a particular custom field option set in the ticket (in this example, it will look for tickets with 'Desired Size' set to Medium or Large):

SELECT DPQL_COUNT() FROM tickets WHERE tickets.custom_data.field_id = '10' OR tickets.custom_data.field_id = '9'
copy

image.png

参考になった役に立たない
次のページPull-Down Menus
前のページList of Functions

コメントを投稿するには、ログインまたは登録が必要です。