Skip to main content
Level 2
June 2, 2026
Question

How to write the correct expression for a custom wait step

  • June 2, 2026
  • 1 reply
  • 12 views

The current journey design adopts wait steps after each segment ranging from 30 mins to 4.5 hrs. This unnecessarily uses a wait nodes. I want to simplify the journey/reduce the number of nodes.

 

Therefore, I instead want to replace these wait nodes with a single custom wait step. I have written an expression. The AJO expression editor has validated the syntax (yay!), so it seems I might be on the right track. However, can anyone confirm that this expression is correct? Do I need to include other functions? Or is there a simpler expression I can write?

Note: I am using the event schema to trigger profiles to enter the journey, and each profile that enters is segmented as defined by the triggerDelay attribute defined in the schema construct. I am using this segment to define the number of minutes to wait ranging from 30 minutes to 270 minutes (4.5 hrs).

if (@event{DW1267_J1_WBC_Dec_AdvocacyDW1267_J1_WBC_Dec_Advocacy._wbg.customerEventAttributes.nonPiiAttributes.triggerDelay} == "1") then
(toDateTimeOnly(nowWithDelta(30,"minutes")))
else
(if (@event{DW1267_J1_WBC_Dec_AdvocacyDW1267_J1_WBC_Dec_Advocacy._wbg.customerEventAttributes.nonPiiAttributes.triggerDelay} == "2") then
(toDateTimeOnly(nowWithDelta(90,"minutes")))
else
(if (@event{DW1267_J1_WBC_Dec_AdvocacyDW1267_J1_WBC_Dec_Advocacy._wbg.customerEventAttributes.nonPiiAttributes.triggerDelay} == "3") then
(toDateTimeOnly(nowWithDelta(150,"minutes")))
else
(if (@event{DW1267_J1_WBC_Dec_AdvocacyDW1267_J1_WBC_Dec_Advocacy._wbg.customerEventAttributes.nonPiiAttributes.triggerDelay} == "4") then
(toDateTimeOnly(nowWithDelta(210,"minutes")))
else
(toDateTimeOnly(nowWithDelta(270,"minutes"))))))


Validated Syntax

 

    1 reply

    Level 2
    June 2, 2026

    Another question I thought of after my post. What if I wanted the else statement to instead send immediately i.e. wait 0 minutes, would I simply use the now() function i.e

    else
    (toDateTimeOnly(now()))

    Or would I write 0 minutes using the nowWithDelta function i.e.

    else
    (toDateTimeOnly(nowWithDelta(0,"minutes")))