조건부 지침(if, then, else) conditional-instruction

조건부 지침(if, then, else)은 고급 편집기에서 지원됩니다. 이를 통해 보다 복잡한 표현식을 정의할 수 있습니다. 이 구성 요소는 다음 요소로 구성됩니다.

  • if: 먼저 평가할 조건입니다.
  • then: 조건 평가 결과가 true인 경우 평가할 식입니다.
  • else: 조건 평가 결과가 false인 경우 평가할 식입니다.
NOTE
모든 표현식에 괄호가 필요합니다.
if  (<expression1>)
then
   (<expression2>)
else
   (<expression3>)

<expression1>은(는) 부울​을 반환해야 합니다.

<expression2>과(와) <expression3>은(는) 같은 형식이거나 호환되는 형식이어야 합니다. 지원되는 서명 및 반환된 유형은 다음과 같습니다.

boolean,boolean : boolean
dateTime,dateTime : dateTime
dateTimeOnly,dateTimeOnly : dateTimeOnly
decimal,integer : decimal
integer,decimal : integer
integer,decimal : decimal
duration,duration : duration
string,string : string
listBoolean,listBoolean : listBoolean
listDateTime,listDateTime : listDateTime
listDateTimeOnly,listDateTimeOnly : listDateTimeOnly
listDateOnly,listDateOnly : listDateOnly
listDecimal,listDecimal : listDecimal
listInteger,listInteger : listInteger
listString,listString : listString

사용

조건부 명령을 사용하면 조건 활동의 수를 줄여 여정 워크플로우를 최적화할 수 있습니다. 예를 들어 동일한 작업 활동 내에서 하나의 조건 표현식만 사용하여 필드 정의에 대한 두 가지 대체 요소를 지정할 수 있습니다.

작업 활동의 예(조건부 명령의 결과로 문자열이 필요한 필드의 경우):

if (startWithIgnoreCase(@event{eventiOSPushPermissionAllowed.device.model}, 'iPad') or startWithIgnoreCase(@event{eventiOSPushPermissionAllowed.device.model}, 'iOS'))
then
   ('apns')
else
   ('fcm')
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 the if / then / else conditional instruction available in the Journey advanced expression editor, including syntax rules, supported type combinations, and a practical usage example.

Intents:

  • Write a conditional expression using if, then, and else to return different values based on a boolean condition
  • Reduce the number of condition activities in a journey by embedding inline conditional logic within a single action activity
  • Determine which data type combinations are valid for the then and else branches
  • Apply the conditional instruction to route push notification tokens to either APNS or FCM based on device model

Glossary:

  • Conditional instruction: An if / then / else expression construct in the advanced editor that evaluates a boolean and returns one of two expressions (product-specific)
  • Advanced expression editor: The Journey Optimizer interface for writing complex expressions used in conditions, wait activities, and action parameter mapping (product-specific)

Guardrails:

  • Parentheses are required around all expressions in the if, then, and else clauses
  • The if clause (<expression1>) must return a boolean type
  • The then and else expressions (<expression2> and <expression3>) must have the same type or compatible types (e.g. decimal and integer are compatible, string and integer are not)
  • Not all type combinations are supported — only the pairs listed in the supported signatures table are valid

Terminology:

  • Canonical name: Conditional Instruction — Acronym: none — variants: if/then/else, ternary-style condition
  • Synonyms: “conditional instruction” = “inline condition” = “if-then-else expression”
  • Do not confuse: conditional instruction (inline expression) ≠ Condition activity (a journey canvas node)

FAQ:

  • Q: Does the if clause need to be wrapped in parentheses? — Yes, parentheses are required around all expressions including the condition in the if clause.
  • Q: Can I use if / then / else to return a number from one branch and a string from another? — No; <expression2> and <expression3> must have the same or compatible types.
  • Q: How does the conditional instruction reduce journey complexity? — It lets you specify two field value alternatives within a single action activity using one expression, avoiding a separate Condition activity node on the canvas.
  • Q: What type does the conditional instruction return if both branches are strings? — It returns a string.
  • Q: Can if / then / else be used to select a push notification channel? — Yes; for example, evaluating the device model to return 'apns' for Apple devices or 'fcm' for others.
recommendation-more-help
journey-optimizer-help