Expand my Community achievements bar.

Join us on September 25th for a must-attend webinar featuring Adobe Experience Maker winner Anish Raul. Discover how leading enterprises are adopting AI into their workflows securely, responsibly, and at scale.
SOLVED

Dynamic date condition in AJO

Avatar

Level 2

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?

1 Accepted Solution

Avatar

Correct answer by
Level 2

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

View solution in original post

11 Replies

Avatar

Community Advisor

@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

Avatar

Correct answer by
Level 2

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

Avatar

Community Advisor

I'm glad that it was helpful for you. Thanks for posting the solution that worked for your use case.

Thanks, Sathees

Avatar

Level 2

Is there a way to calculate the difference from a field whose value is date, for example -

 

@{Myevent._xyz.subscription.expiry_date} - 90 'days'? 

 

I want to use the above in a wait condition.

 

Thank you,

Sirisha

Avatar

Community Advisor

@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-advanc...

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

Thanks, Sathees

Avatar

Level 2

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

 

Thank you,

Sirisha

Avatar

Level 2

Hi @SatheeskannaK 

We have similar requirement but the setDays is throwing a run time error when it have a negative number of days.
Set Days is trying to set to that particular day of the month (if provided positive)

 

Is there any other function that can be used to achieve this?

 

@sirisha_ganti 

 

Thanks

Avatar

Level 2

Hello @sirisha_ganti and @SatheeskannaK ,

Is it possible to change the '90 days' to a calculated value?

e.g. toDateOnly(toString(nowWithDelta(round(122/3),'days')))

I'm also not able to use a dynamic value here:

e.g. toDateOnly(toString(nowWithDelta(#{ExperiencePlatform.DateFields.profile._repo.createDate},'days')))

Thanks

Avatar

Administrator

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

Avatar

Level 2

Hi Sukrity,

 

Thank you for the follow up. That was helpful.

 

regards,

Sirisha

Avatar

Administrator

Thanks for the update @sirisha_ganti!



Sukrity Wadhwa