SOLVED

Building a birthday / anniversary email without using Wait Step > Next Anniversary

Go to solution
Megan_Koelemay
Level 4

Building a birthday / anniversary email without using Wait Step > Next Anniversary

Hi there, 

 

I'm aware of how to build birthday / anniversary emails using a date token in a wait flow step, as outlined here: https://experienceleague.adobe.com/docs/marketo/using/product-docs/core-marketo-concepts/smart-campa...

 

But I would like to avoid using such a long wait step, in case there are unexpected changes in the data during that time.  We ran into this problem in a past iteration of our birthday emails - for example, an incorrect or fake Date of Birth was entered in our CRM, and then was corrected at a later date.  Since the campaign was in a wait step, the correction didn't register, and a birthday email was delivered on the wrong day.  

 

Anyone know of a way to get around this?  I basically want to do a daily batch campaign like this:

  • If the anniversary of the Date of Birth is today, then send email.  

Our IT/Systems staff (non-Marketo users) suggested this:

  • Create a new field that is the birthday anniversary for their next b-day. Then we could have a smartlist that searches to see that today is a match for that field. That field would need to be updated any time the birthday is updated or after the campaign is run. I would hope the campaign could update the anniversary field to next years date after it sends the email but I’m not sure if that’s an action that can be in the flow.

Thoughts/ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Building a birthday / anniversary email without using Wait Step > Next Anniversary




@SanfordWhiteman wrote:

Then use Change Data Value to set Next Anniversary Date to {{lead.Next Anniversary Date}} + 1 year.


So if I'm understanding the portion above correctly, that takes care of ensuring the birthday campaign continues to run year after year.  


Right.

 



For the new field, should I set the field type to Date?

 

My challenge now is how to get the anniversary date in the first place.  The only field we have to work with is Date of Birth, which obviously includes the year of birth and can't be used as an anniversary.  I've seen suggestions in the forums that a webhook can be used to achieve this.  I haven't used webhooks before, so was hoping for a Marketo solution.  But hey, always fun to learn something new!  


Yep.

 


My challenge now is how to get the anniversary date in the first place.  The only field we have to work with is Date of Birth, which obviously includes the year of birth and can't be used as an anniversary.  I've seen suggestions in the forums that a webhook can be used to achieve this.  I haven't used webhooks before, so was hoping for a Marketo solution.  But hey, always fun to learn something new!  


True. If your external system can’t start it off on the right date, your challenge is to initialize the field to the first anniversary date after today, after which it’ll run automatically. There’s no way to do this with only internal Marketo functions. A webhook-compatible service can do it quite easily. For example if your service runs/understands JS, the code could be like so:

let today = new Date();
let dateOfBirth = new Date({{Lead.Date of Birth}});
var nextBirthday = new Date(dateOfBirth);

nextBirthday.setYear(today.getFullYear());
if( nextBirthday < today ) {
  nextBirthday.setYear(nextBirthday.getFullYear() + 1);
}

 

This makes a clone of the Date of Birth, then sets its year to the current year. That is, if my birthday is 2010-06-01, then the clone is 2022-06-01.  Then it does a final check to see if the clone is in the past (i.e. earlier this year) and if so, pushes it forward one more year. After that it’s good to go.

View solution in original post

21 REPLIES 21
SanfordWhiteman
Level 10 - Community Moderator

Re: Building a birthday / anniversary email without using Wait Step > Next Anniversary

I don't like the Wait method either - no matter how common - for the reasons you note.

 

You can have a field named Next Anniversary Date and run a batch exactly as you say. Then use Change Data Value to set Next Anniversary Date to {{lead.Next Anniversary Date}} + 1 year.

Megan_Koelemay
Level 4

Re: Building a birthday / anniversary email without using Wait Step > Next Anniversary

Thanks @SanfordWhiteman!  I didn't realize until today when I stumbled upon this other post with your reply that the + [timeframe]  is a possibility!!  And your application above is brilliant! 

 


@SanfordWhiteman wrote:

Then use Change Data Value to set Next Anniversary Date to {{lead.Next Anniversary Date}} + 1 year.


So if I'm understanding the portion above correctly, that takes care of ensuring the birthday campaign continues to run year after year.  

 


@SanfordWhiteman wrote:

You can have a field named Next Anniversary Date 


For the new field, should I set the field type to Date?

 

My challenge now is how to get the anniversary date in the first place.  The only field we have to work with is Date of Birth, which obviously includes the year of birth and can't be used as an anniversary.  I've seen suggestions in the forums that a webhook can be used to achieve this.  I haven't used webhooks before, so was hoping for a Marketo solution.  But hey, always fun to learn something new!  

SanfordWhiteman
Level 10 - Community Moderator

Re: Building a birthday / anniversary email without using Wait Step > Next Anniversary




@SanfordWhiteman wrote:

Then use Change Data Value to set Next Anniversary Date to {{lead.Next Anniversary Date}} + 1 year.


So if I'm understanding the portion above correctly, that takes care of ensuring the birthday campaign continues to run year after year.  


Right.

 



For the new field, should I set the field type to Date?

 

My challenge now is how to get the anniversary date in the first place.  The only field we have to work with is Date of Birth, which obviously includes the year of birth and can't be used as an anniversary.  I've seen suggestions in the forums that a webhook can be used to achieve this.  I haven't used webhooks before, so was hoping for a Marketo solution.  But hey, always fun to learn something new!  


Yep.

 


My challenge now is how to get the anniversary date in the first place.  The only field we have to work with is Date of Birth, which obviously includes the year of birth and can't be used as an anniversary.  I've seen suggestions in the forums that a webhook can be used to achieve this.  I haven't used webhooks before, so was hoping for a Marketo solution.  But hey, always fun to learn something new!  


True. If your external system can’t start it off on the right date, your challenge is to initialize the field to the first anniversary date after today, after which it’ll run automatically. There’s no way to do this with only internal Marketo functions. A webhook-compatible service can do it quite easily. For example if your service runs/understands JS, the code could be like so:

let today = new Date();
let dateOfBirth = new Date({{Lead.Date of Birth}});
var nextBirthday = new Date(dateOfBirth);

nextBirthday.setYear(today.getFullYear());
if( nextBirthday < today ) {
  nextBirthday.setYear(nextBirthday.getFullYear() + 1);
}

 

This makes a clone of the Date of Birth, then sets its year to the current year. That is, if my birthday is 2010-06-01, then the clone is 2022-06-01.  Then it does a final check to see if the clone is in the past (i.e. earlier this year) and if so, pushes it forward one more year. After that it’s good to go.

Megan_Koelemay
Level 4

Re: Building a birthday / anniversary email without using Wait Step > Next Anniversary

Thanks @SanfordWhiteman!  Appreciate the code and explanation!!

 

Thinking about the wait step w/anniversary option again - I wonder if it would work to set up a separate triggered campaign so if there's a data value change on the Date of Birth, then it would remove someone out of the birthday campaign wait step and re-enter them into it using the new date.  Like this:

 

Smart List:

Trigger --> Data Value Changes, Attribute: Date of Birth

 

Flow:

1 - Remove From Flow --> Campaign is [Happy Birthday Email]

2 - Request Campaign  --> Requested Campaign is [Happy Birthday Email]

SanfordWhiteman
Level 10 - Community Moderator

Re: Building a birthday / anniversary email without using Wait Step > Next Anniversary

Right, this is how you can recycle them through the campaign, but it doesn't get away from the Waits.

Megan_Koelemay
Level 4

Re: Building a birthday / anniversary email without using Wait Step > Next Anniversary

Wouldn't the combination of the wait step w/anniversary option and a campaign setting of allowing each person to run through the flow only once every 364 (or 365??) days do the trick of recycling?  

 

 

SanfordWhiteman
Level 10 - Community Moderator

Re: Building a birthday / anniversary email without using Wait Step > Next Anniversary

More like 366 but no, that won't help because (as you correctly pointed out) if someone's original date changes from 6/1/1980 to 5/1/1980, they need to reenter the campaign promptly, ergo before 366 days have elapsed.
Megan_Koelemay
Level 4

Re: Building a birthday / anniversary email without using Wait Step > Next Anniversary

Also, any recommendations for webhook / webhook-compatible services?  

 

SanfordWhiteman
Level 10 - Community Moderator

Re: Building a birthday / anniversary email without using Wait Step > Next Anniversary


Also, any recommendations for webhook / webhook-compatible services?  

Alas, no, due to Community guidelines.