このページ:実行時に動的に入力されるように、シンプル コレクションとオブジェクト コレクションをカスタム アクション パラメーターに渡す方法を説明します。
実行時に値が動的に入力されるコレクションをカスタムアクションパラメーターに渡すことができます。
次の 2 つのタイプのコレクションがサポートされています。
-
シンプルなコレクション
文字列、数値、ブール値などの基本的な値のリストには、シンプルなコレクションを使用します。 これらは、追加のプロパティなしで項目のリストのみを渡す必要がある場合に役立ちます。
例えば、デバイスタイプのリストは次のようになります。
code language-json { "deviceTypes": [ "android", "ios" ] } -
オブジェクトコレクション
各項目に複数のフィールドやプロパティが含まれている場合は、オブジェクトコレクションを使用します。 これらは通常、製品の詳細、イベントレコード、項目属性などの構造化データを渡すために使用されます。
次に例を示します。
code language-json { "products":[ { "id":"productA", "name":"A", "price":20.1 }, { "id":"productB", "name":"B", "price":10.0 }, { "id":"productC", "name":"C", "price":5.99 } ] }
一般的な手順 general-procedure
この節では、次の JSON ペイロードの例を使用します。 これは、単純なコレクションのフィールドを持つオブジェクトの配列です。
{
"ctxt": {
"products": [
{
"id": "productA",
"name": "A",
"price": 20.1,
"color":"blue",
"locations": [
"Paris",
"London"
]
},
{
"id": "productB",
"name": "B",
"price": 10.99
}
]
}
}
products は 2 つのオブジェクトの配列であることがわかります。 少なくとも 1 つのオブジェクトが必要です。
-
カスタムアクションを作成します。 詳しくは、このページを参照してください。
-
「アクションパラメーター」セクションに、JSON の例を貼り付けます。 表示される構造は静的です。ペイロードを貼り付けたときに、すべてのフィールドが定数として定義されます。
-
必要に応じて、フィールドタイプを調整します。 コレクションでは、listString、listInteger、listDecimal、listBoolean、listDateTime、listDateTimeOnly、listDateOnly、listObject の各フィールドタイプがサポートされています。
note NOTE フィールドタイプは、ペイロードの例に従って自動的に推測されます。 -
オブジェクトを動的に渡す場合は、変数として設定する必要があります。 この例では、
productsを変数として設定します。 オブジェクトに含まれているすべてのオブジェクトフィールドは、変数に自動的に設定されます。note NOTE サンプルペイロードの最初のオブジェクトは、フィールドの定義に使用されます。 -
フィールドごとに、ジャーニーキャンバスに表示されるラベルを定義します。
{width="70%"}
-
ジャーニーを作成し、作成したカスタムアクションを追加します。 詳しくは、このページを参照してください。
-
「アクションパラメーター」セクションで、高度な式エディターを使用して配列パラメーター(この例では
products)を定義します。
-
次のオブジェクトフィールドごとに、ソース XDM スキーマ内の対応するフィールド名を入力します。 名前が同じ場合は、この操作は不要です。 この例では、
product idと「color」のみを定義する必要があります。 {width="50%"}
配列フィールドの場合は、高度な式エディターを使用してデータ操作を実行することもできます。 次の例では、filter 関数と intersect 関数を使用しています。
制限事項 limitations
カスタムアクションのコレクションは動的データを渡すための柔軟性を提供しますが、注意すべき特定の構造上の制約があります。
-
カスタムアクションでのネストされた配列のサポート
Adobe Journey Optimizerは、カスタムアクション 応答ペイロードのオブジェクトのネストされた配列をサポートしていますが、このサポートは 要求ペイロード に制限されています。
リクエストペイロードでは、ネストされた配列は、カスタムアクション設定で定義されているように、固定数の項目が含まれている場合にのみサポートされます。 例えば、ネストされた配列に常に 3 つの項目が含まれる場合は、定数として設定できます。 項目の数を動的にする必要がある場合、ネストされていない配列(下部レベルの配列)のみを変数として定義できます。
例:
-
次の例は、サポートされていないユースケースを示しています。
この例では、products 配列に、動的な項目数を持つネストされた配列(
locations)が含まれていますが、これはリクエストペイロードではサポートされていません。code language-json { "products": [ { "id": "productA", "name": "A", "price": 20, "locations": [ { "name": "Paris" }, { "name": "London" } ] } ] } -
定数として定義された固定項目でサポートされる例。
この場合、ネストされた場所は固定フィールド(
location1、location2)に置き換えられ、サポートされる設定内でペイロードを有効なままにすることができます。code language-json { "products": [ { "id": "productA", "name": "A", "price": 20, "location1": { "name": "Paris" }, "location2": { "name": "London" } } ] }
-
-
コレクションのテスト:テストモードを使用してコレクションをテストするには、コードビューモードを使用する必要があります。 コードビューモードはビジネスイベントではサポートされていないので、その場合は 1 つの要素を含むコレクションのみを送信できます。
特殊な例 examples
異種混在タイプと配列の配列の場合、配列は listAny タイプで定義されます。 個々の項目のみをマッピングできますが、配列を変数に変更することはできません。
異種混在タイプの例:
{
"data_mixed-types": [
"test",
"test2",
null,
0
]
}
配列の配列の例:
{
"data_multiple-arrays": [
[
"test",
"test1",
"test2"
]
]
}
その他のリソース
カスタムアクションの設定、使用、トラブルシューティングについて詳しくは、以下の節を参照してください。
- カスタムアクションの基本を学ぶ - カスタムアクションの概要と、サードパーティシステムへの接続に役立つ仕組みについて説明します。
- カスタムアクションの設定 - カスタムアクションの作成および設定方法について説明します
- カスタムアクションの使用 - ジャーニーでのカスタムアクションの使用方法について説明します
- カスタムアクションのトラブルシューティング - カスタムアクションのトラブルシューティング方法について説明します
- コンテキストデータの繰り返し - メッセージ式の配列を操作する方法と、ジャーニーパーソナライゼーションのカスタムアクション応答、イベントデータ、データセット参照を繰り返す方法について説明します
This section contains structured knowledge intended to support interpretation, retrieval, and question answering related to this topic.
For complete understanding, this information should be combined with the documentation on this page. Neither source is intended to stand alone; the page describes the feature, while this section provides additional context that helps disambiguate terminology, intent, applicability, and constraints.
- TL;DR: This page explains how to pass simple and object collections dynamically into custom action parameters in Journey Optimizer, including supported field types, the configuration procedure, and known limitations around nested arrays.
Intents:
- Configure a custom action to accept a collection (simple or object) as a dynamic parameter
- Define array parameters as variables in the advanced expression editor when building a journey
- Apply filter and intersect functions to manipulate array data in the expression editor
- Understand and work within the nested array limitations for custom action request payloads
- Test collection parameters using code view mode in journey test mode
Glossary:
- Simple collection: A list of basic scalar values (strings, numbers, booleans) passed as a custom action parameter (product-specific)
- Object collection: A list of structured objects, each with multiple fields, passed as a custom action parameter (product-specific)
- listObject: The field type used in custom action configuration to represent an array of objects (product-specific)
- listAny: The field type used for heterogeneous arrays or arrays of arrays where items have mixed types (product-specific)
- Variable (vs. Constant): In action parameter configuration, a field set to “variable” is populated dynamically at runtime from the journey context, while a “constant” is a fixed value set at configuration time (product-specific)
Guardrails:
- Nested arrays in request payloads are only supported when they contain a fixed number of items (defined as constants); dynamic nested arrays are not supported
- Code view mode is required to test collections in test mode; code view is not supported for business events, so only single-element collections can be sent in that case
- At least one object must be present in the payload example used to define collection fields
- The first object of the payload example defines the fields for the entire collection
Terminology:
- Canonical name: Collection — Acronym: none — variants: array, list, dynamic collection
- Synonyms: “simple collection” = “list of scalar values” ; “object collection” = “array of objects”
- Do not confuse: “listAny” ≠ “listObject” (listAny handles heterogeneous or nested arrays; listObject handles uniform arrays of structured objects)
FAQ:
- Q: What is the difference between a simple collection and an object collection? — A simple collection contains basic scalar values (strings, numbers, booleans), while an object collection contains structured objects each with multiple named fields.
- Q: How do I make a collection parameter dynamic at runtime? — In the custom action’s Action parameters section, set the array field to “variable”; all object fields within it are then automatically set to variables.
- Q: Are nested arrays supported in custom action request payloads? — Only partially. Nested arrays with a fixed, known number of items can be defined as constants. Nested arrays with a dynamic number of items are not supported in request payloads.
- Q: How do I test a collection in journey test mode? — Use code view mode in the test interface. Note that business events do not support code view, so only single-element collections can be tested in that context.
- Q: What field types are supported for collections? — listString, listInteger, listDecimal, listBoolean, listDateTime, listDateTimeOnly, listDateOnly, and listObject are all supported.