Skip Navigation
Expand
ROQLによるカスタム・フィールドのクエリー
Answer ID 7620   |   Last Review Date 03/18/2019

ROQLを使用して、カスタム・フィールドをクエリーするにはどうすればよいですか。

環境:

ROQL、SOAP API

解決策:

ROQLによってカスタム・フィールドをクエリーするためには、クエリーでObjectTemplateを提供する必要があります。カスタム・フィールドのROQLクエリーを生成するコードは、様々なエンドポイントを使用すると、様々に書くことができますが、結果のSOAPエンベロープは似たものになります。 テンプレートによるQueryObjectsの呼び出しを利用すると、次のようなSOAPエンベロープになります。

<s:Envelope xmlns:u='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd' xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'>
<s:Header>
<h:ClientInfoHeader xmlns='urn:messages.ws.rightnow.com/v1_2' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:h='urn:messages.ws.rightnow.com/v1_2' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<AppID>Basic Objects Sample</AppID>
</h:ClientInfoHeader>
<o:Security s:mustUnderstand='1' xmlns:o='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'>
<o:UsernameToken u:Id='uuid-84093390-78b8-44db-acba-6a792c0a22a3-1'>
<o:Username>user</o:Username>
<o:Password>password</o:Password>
</o:UsernameToken>
</o:Security>
</s:Header>
<s:Body xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<QueryObjects xmlns='urn:messages.ws.rightnow.com/v1_2'>
<Query>SELECT Incident FROM Incident WHERE ID = 1</Query>
<ObjectTemplates xmlns:q1='urn:objects.ws.rightnow.com/v1_2' xsi:type='q1:Incident'>
<q1:CustomFields />
</ObjectTemplates>
<PageSize>10000</PageSize>
</QueryObjects>
</s:Body>
</s:Envelope>

次のドキュメントのページには、このトピックに関する追加情報が含まれます。
QueryObjects
ROQL and Common Objects
ROQL and Custom Objects

または、オブジェクト・テンプレートを使用せずに、QueryCSV関数を使用して、カスタム・フィールドをクエリーすることもできます。

原因:

QueryObjects関数は、オブジェクトを返すように設計されています。カスタム・フィールドは、それらに設定されているデータ型(integer、menu、stringなど)のみを格納しており、オブジェクトではないため、カスタム・フィールド情報を適用するには、テンプレートを提供する必要があります。

Available Languages for this Answer:

Notify Me
The page will refresh upon submission. Any pending input will be lost.