フィールド参照 field-references

フィールド参照は、イベントまたはフィールドグループに添付できます。 意味のある情報は、フィールドの名前とパスだけです。

フィールドに特殊文字を使用する場合は、二重または一重の引用符を使用する必要があります。 次のような場合には引用符が必要です。

  • フィールドが数字で始まる
  • フィールドが「-」文字で始まる
  • フィールドに azAZ09-_ 以外の文字が含まれる

例えば、フィールドが​ 3h ​の場合:#{OpenWeather.weatherData.rain.‘3h’} > 0

// event field
@event{<event name>.<XDM path to the field>}
@event{LobbyBeacon.endUserIDs._experience.emailid.id}

// field group
#{<data source name>.<field group name>.<path to the field>}
#{ExperiencePlatform.ProfileFieldGroup.profile.personalEmail.address}

式では、イベントフィールドは「@」で参照され、データソースフィールドは「#」で参照されます。

構文の色を使用して、イベントフィールド(緑)とフィールドグループ(青)を視覚的に区別します。

フィールド参照のデフォルト値 default-value

デフォルト値をフィールド名に関連付けることができます。 構文は以下のとおりです。

// event field
@event{<event name>.<XDM path to the field>, defaultValue: <default value expression>}
@event{LobbyBeacon.endUserIDs._experience.emailid.id, defaultValue: "example@adobe.com"}
// field group
#{<data source name>.<field group name>.<path to the field>, defaultValue: <default value expression>}
#{ExperiencePlatform.ProfileFieldGroup.profile.personalEmail.address, defaultValue: "example@adobe.com"}
NOTE
フィールドとデフォルト値のタイプは同じにする必要があります。 例えば、想定される値が文字列であるのに対し、デフォルト値が整数であるため、@event{LobbyBeacon.endUserIDs._experience.emailid.id, defaultValue : 2} は無効になります。

例:

// for an event 'OrderEvent' having the following payload:
{
    "orderId": "12345"
}

expression example:
- @event{OrderEvent.orderId}                                    -> "12345"
- @event{OrderEvent.productId, defaultValue : "not specified" } -> "not specified" // default value, productId is not a field present in the payload
- @event{OrderEvent.productId}                                  -> null


// for an entity 'Profile' on datasource 'ACP' having fields person/lastName, with fetched data such as:
{
    "person": {
        "lastName":"Snow"
    },
    "emails": [
        { "email":"john.snow@winterfell.westeros" },
        { "email":"snow@thewall.westeros" }
    ]
}

expression examples:
- #{ACP.Profile.person.lastName}                 -> "Snow"
- #{ACP.Profile.emails.at(1).email}              -> "snow@thewall.westeros"
- #{ACP.Profile.person.age, defaultValue : -1}   -> -1 // default value, age is not a field present in the payload
- #{ACP.Profile.person.age}                      -> null

任意の種類の式をデフォルト値として追加できます。 唯一の制約は、期待されるデータタイプを、式が返す必要があるということです。 関数を使用する場合は、() で関数をカプセル化する必要があります。

#{ExperiencePlatform.Subscriptions.profile.consents.marketing.any.time, defaultValue : (now())}
== date("2022-02-10T00:00:00Z")

コレクション内のフィールドへの参照

コレクション内で定義された要素は、特定の関数 allfirst および last を使用して参照します。 詳しくは、このページを参照してください。

例:

@event{LobbyBeacon._experience.campaign.message.profile.pushNotificationTokens.all()

マップ内で定義されたフィールドへの参照

entry 関数

マップ内の要素を取得するには、指定のキーで entry 関数を使用します。 例えば、イベントのキーを定義する際に、選択した名前空間に応じて使用します。 詳しくは、このページを参照してください。

@event{MyEvent.identityMap.entry('Email').first().id}

この式では、イベントの「IdentityMap」フィールドの「Email」キーのエントリを取得しています。 「Email」エントリはコレクションであり、そこから「first()」を使用して最初の要素の「id」を取得します。 詳しくは、このページを参照してください。

firstEntryKey 関数

マップの最初のエントリキーを取得するには、firstEntryKey 関数を使用します。

次の例では、特定のリストの購読者の最初のメールアドレスを取得する方法を示しています。

#{ExperiencePlatform.Subscriptions.profile.consents.marketing.email.subscriptions.entry('daily-email').subscribers.firstEntryKey()}

この例では、サブスクリプションリストの名前は daily-email です。 メールアドレスは、subscribers マップでキーとして定義されています。このマップはサブスクリプションリストマップにリンクされています。

keys 関数

マップのすべてのキーを取得するには、 keys 関数を使用します。

次の例では、特定のプロファイルについて、特定のリストの購読者に関連付けられているすべてのメールアドレスを取得する方法を示しています。

#{ExperiencePlatform.Subscriptions.profile.consents.marketing.email.subscriptions.entry('daily-mail').subscribers.keys()

データソースのパラメーター値(データソースの動的な値)

パラメーターの呼び出しが必要な外部データソースからフィールドを選択すると、新しいタブが右側に表示され、そのパラメーターを指定できます。 このページを参照してください。

より複雑なユースケースの場合、データソースのパラメーターをメイン式に含めるには、params キーワードを使用して、そのパラメーター値を定義できます。 パラメーターは有効な式であれば、別のパラメーターも含む別のデータソースの式でも構いません。

NOTE
式にパラメーター値を定義すると、右側のタブが消えます。

次の構文を使用します。

#{<datasource>.<field group>.fieldName, params: {<params-1-name>: <params-1-value>, <params-2-name>: <params-2-value>}}
  • <params-1-name>:データソースに存在する最初のパラメーターの正確な名前。
  • <params-1-value>:最初のパラメーターの値。 任意の有効な式を指定できます。

例:

#{Weather.main.temperature, params: {localisation: @event{Profile.address.localisation}}}
#{Weather.main.temperature, params: {localisation: #{GPSLocalisation.main.coordinates, params: {city: @event{Profile.address.city}}}}}
AI Knowledge Reference

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 reference event fields and data source field groups in journey expressions, including default value syntax, map access functions (entry, firstEntryKey, keys), and inline data source parameter passing with the params keyword.

Intents:

  • Reference an event field in an expression using the @event{eventName.fieldPath} syntax
  • Reference a data source field group using the #{dataSourceName.fieldGroupName.fieldPath} syntax
  • Assign a fallback default value to a field reference so expressions do not return null
  • Retrieve a specific entry from an identity map or subscription map using the entry() function
  • Retrieve all keys from a map field using the keys() function
  • Pass parameter values to an external data source inline using the params keyword

Glossary:

  • Field reference: An expression syntax that points to a named field within an event payload or data source field group (product-specific)
  • defaultValue: An optional fallback expression appended to a field reference that is returned when the field is absent or null (product-specific)
  • entry(key): A map function that retrieves the collection entry associated with the given key (product-specific)
  • firstEntryKey(): A map function that returns the first key of a map field (product-specific)
  • keys(): A map function that returns all keys of a map field (product-specific)
  • params keyword: Inline syntax for specifying parameter values for external data source fields within the main expression (product-specific)

Guardrails:

  • Field names containing special characters (starting with a digit, containing -, or characters outside a-z A-Z 0-9 _) must be wrapped in single or double quotes
  • The default value expression must return the same data type as the field — mismatched types are invalid
  • When the params keyword is used to define parameter values inline, the separate parameter tab on the right of the editor disappears
  • Functions used as default values must be encapsulated in parentheses

Terminology:

  • Canonical name: Field References — Acronym: none — variants: field path, field expression
  • Synonyms: @event{...} = “event field reference”; #{...} = “data source field reference”
  • Do not confuse: event fields (prefixed @) ≠ data source fields (prefixed #)

FAQ:

  • Q: How do I reference a field whose name starts with a number? — Wrap the field name in single or double quotes, e.g. #{OpenWeather.weatherData.rain.'3h'}.
  • Q: What happens when a referenced field is missing from the event payload and no default value is set? — The expression returns null.
  • Q: How do I set a dynamic default value using a function? — Wrap the function call in parentheses, e.g. defaultValue: (now()).
  • Q: How do I retrieve the email address stored as the first key in a subscriber map? — Use the firstEntryKey() function on the subscribers map field.
  • Q: How do I pass a parameter to an external data source without using the right-side tab? — Use the params keyword inline: #{DataSource.group.field, params: {paramName: value}}.
recommendation-more-help
journey-optimizer-help