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 30, 2023

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


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

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