Oracle の Rightnow API でカスタム メニュー フィールドの値を設定する方法
次のようなデータ型メニューのカスタム フィールドがあります。
カスタム フィールド名: ユーザー タイプ
データ型 : メニュー
値は次のいずれかです: 無料、有料、またはプレミアム
この問題を解決して Java コードを送ってくれる人はいますか?
前もって感謝します
Oracle の Rightnow API でカスタム メニュー フィールドの値を設定する方法
次のようなデータ型メニューのカスタム フィールドがあります。
カスタム フィールド名: ユーザー タイプ
データ型 : メニュー
値は次のいずれかです: 無料、有料、またはプレミアム
この問題を解決して Java コードを送ってくれる人はいますか?
前もって感謝します
次のリンクは、Oracle Service Cloud 開発者ドキュメントからのものです。Java と Axis2 を使用して連絡先カスタム フィールドを設定する例があり、カスタム フィールドを設定するために必要なほとんどの情報が得られます。
大まかに言うと、インシデント オブジェクトを作成し、更新するインシデントの ID を指定する必要があります。次に、一般的なオブジェクトを使用してカスタム フィールド オブジェクト構造を作成する必要があります (各サイトが独自のカスタム フィールドを持つことができるため)。最終的に、SOAP エンベロープには、Java コードで作成したノード構造が含まれます。メニューを設定しようとしているので、カスタム フィールドは NamedID オブジェクトになります。メニューのルックアップ名を、上で指定した 3 つの値のいずれかに設定します。
私自身は C# 派なので、私の例は C# ですが、上記のリンクを例として使用して Java に簡単に移植できるはずです。
public static void SetMenuTest()
{
Incident incident = new Incident();
incident.ID = new ID();
incident.ID.id = 1234;
incident.ID.idSpecified = true;
GenericField customField = new GenericField();
customField.name = "user_type";
customField.dataType = DataTypeEnum.NAMED_ID;
customField.dataTypeSpecified = true;
customField.DataValue = new DataValue();
customField.DataValue.Items = new object[1];
customField.DataValue.ItemsElementName = new ItemsChoiceType[18]; //18 is a named ID value. Inspect ItemChoiceTypes for values.
customField.DataValue.Items[0] = "Free"; //Or Paid, or Premium
customField.DataValue.ItemsElementName[0] = ItemsChoiceType.NamedIDValue;
GenericObject customFieldsc = new GenericObject();
customFieldsc.GenericFields = new GenericField[1];
customFieldsc.GenericFields[0] = customField;
customFieldsc.ObjectType = new RNObjectType();
customFieldsc.ObjectType.TypeName = "IncidentCustomFieldsc";
GenericField cField = new GenericField();
cField.name = "c";
cField.dataType = DataTypeEnum.OBJECT;
cField.dataTypeSpecified = true;
cField.DataValue = new DataValue();
cField.DataValue.Items = new object[1];
cField.DataValue.Items[0] = customFieldsc;
cField.DataValue.ItemsElementName = new ItemsChoiceType[1];
cField.DataValue.ItemsElementName[0] = ItemsChoiceType.ObjectValue;
incident.CustomFields = new GenericObject();
incident.CustomFields.GenericFields = new GenericField[1];
incident.CustomFields.GenericFields[0] = cField;
incident.CustomFields.ObjectType = new RNObjectType();
incident.CustomFields.ObjectType.TypeName = "IncidentCustomFields";
}