Solved

Can you show/hide block based on the date an email is sent?

  • 29 November 2023
  • 2 replies
  • 62 views

Badge +3

Hello,

As Xmas is approaching I wanted to customize some of my flows to include Xmas based alerts (i.e. Order by December 15th for delivery before Christmas).

I am wondering if it’s possible to set up a show/hide block where the conditional logic is tied to the date the email is received (or even the date an order is placed which triggers the flow)? I have an metric-based flow right now and the only variables I see are event variables and none of them seem to relate to the actual time/date/place of the orders. 

Any help would be much appreciated.

 

icon

Best answer by bluesnapper 30 November 2023, 13:09

View original

2 replies

Userlevel 7
Badge +36

Welcome to the community @christianhelio 

I've attempted to do this using event data and dates in display logic but never succeeded!

Here's the solution I came up with. I'm still testing but it’s working OK.

It has an added benefit: I can easily see the date of the last order in a profile's custom properties without filtering events.

The example is for a placed order, but the approach can be used in any flow.

In your placed order metric flow, add an 'update profile property' action immediately after the trigger. Choose 'Create New Property' with a label of last_order_date and data type 'date'. Also select 'Use current date when step is reached'. This will timestamp the date of the customer's order. I've shown this below

I have the same use case as you - a cut-off date for Xmas deliveries - but I've kept it simple in the display logic: show the block if the date in the custom property is less than the cut-off date. The logic is: person|lookup:'last_order_date' < '2023-12-16' so the block displays until midnight on the 15th.

If you make this block universal content, you can update that on the 15th to "...final day for Xmas deliveries..." which will update all email instances where that block is being used.

As I mentioned, I’m still testing this, and I suggest you do the same in preview mode before taking it live.

Hope that helps, and let me know how you get on.

Andy

 

Badge +3

Hi Andy

Thanks very much for the response. It’s an elegant solution and it appears to be working quite well for me. Thanks for sharing it!

 

Christian

Reply