Dynamic date condition in AJO | Community
Skip to main content
Level 2
October 2, 2023
Solved

Dynamic date condition in AJO

  • October 2, 2023
  • 2 replies
  • 3805 views

I have a requirement in the journey that I creating. The requirement is to check on a date attribute to see if it is "y" days from current date i.e., let's say that "end_date" is 'xx-xx-xxxx xx:xx:xx' and it is equal to y days from today's date, then continue with the journey, otherwise end right there. When I pick the date field attribute and try to check if it is current_date + y days, I don't get the current_date option. It looks like the check will happen "y" days after when I create the journey. How do I implement the same in AJO?

Best answer by sirisha_ganti

Hi Sathees,

 

I could not respond immediately. The above solution is partially correct. The right function for my use case is nowWithDelta.

 

toDateOnly(toString(nowWithDelta(90,'days')))=toDateOnly("2023-10-06T00:00:00")

 

Your note helped me find the working solution quicker.

 

Thank you,

Sirisha

2 replies

SatheeskannaK
Community Advisor
Community Advisor
October 2, 2023

@sirisha_ganti, Try this expression in the journey condition considering the end date is 4 days from today.

toDateOnly(toString(inNextDays(now(),4)))==toDateOnly("2023-10-06T00:00:00")

Thanks, Sathees
sirisha_gantiAuthorAccepted solution
Level 2
October 11, 2023

Hi Sathees,

 

I could not respond immediately. The above solution is partially correct. The right function for my use case is nowWithDelta.

 

toDateOnly(toString(nowWithDelta(90,'days')))=toDateOnly("2023-10-06T00:00:00")

 

Your note helped me find the working solution quicker.

 

Thank you,

Sirisha

Level 2
October 31, 2023

@sirisha_ganti You can try setDays function. Remember wait activity will accept dateTimeOnly format.

https://experienceleague.adobe.com/docs/journey-optimizer/using/orchestrate-journeys/building-advanced-conditions-journeys/main-functions-journey/date/functionsetdays.html?lang=en

setDays(toDateTimeOnly(@{Myevent._xyz.subscription.expiry_date}),-90)


Thank you for your reply. I will try it and get back.

 

Thank you,

Sirisha

Sukrity_Wadhwa
Community Manager
Community Manager
October 10, 2023

Hi @sirisha_ganti,

Was the given solution by @satheeskannak helpful to resolve your query or do you still need more help here? Do let us know.

Thanks!

Sukrity Wadhwa
Level 2
October 11, 2023

Hi Sukrity,

 

Thank you for the follow up. That was helpful.

 

regards,

Sirisha

Sukrity_Wadhwa
Community Manager
Community Manager
October 12, 2023

Thanks for the update @sirisha_ganti!

Sukrity Wadhwa