SOLVED

Re: Calculate number of years based on a date field

Go to solution
Sarah_Greig2
Level 3

Re: Calculate number of years based on a date field

had a quick look at the documentation. So you would get the webhook to check that the date was todays date and then put a true/false in a field which would then trigger the email?

SanfordWhiteman
Level 10 - Community Moderator

Re: Calculate number of years based on a date field

OK, that specific goal can be accomplished in Marketo without webhook assistance -- look for "birthday" or "anniversary campaign" in the Community. (Renewal is a form of anniversary.)

But don't get too optimistic as not all date-related goals are possible natively. For example, extended date comparison in a SC Flow (not in Smart List qualification), and arbitrary comparison between two dates or date-like strings, needs a webhook to do the (pre)calculation.

Sarah_Greig2
Level 3

Re: Calculate number of years based on a date field

The renewal dates are different lengths e.g they could be 12 months, 18 months etc. I get that I could maybe put in a calculated field e.g renewal date = 30/04/2018 x 12 months = (Renewal Date) but then how do I get Marketo to know to send on that specific date if it is Today?>

SanfordWhiteman
Level 10 - Community Moderator

Re: Calculate number of years based on a date field

Have you checked out the anniversary/birthday best practices? You can have different campaigns with different lengths (as long as there aren't like 100s of different options to keep track of).

Victor_Herrero
Level 5

Re: Calculate number of years based on a date field

Hi Sanford Whiteman​,

Thanks for sharing this.

I managed to modify it to work (on a test email) with our system but I am having trouble passing the calculated value into an integer field.

pastedImage_0.png

Is there any way to get around this? I take it the problem is the "email script token" is understood as a "text" input type.

Thanks!

SanfordWhiteman
Level 10 - Community Moderator

Re: Calculate number of years based on a date field

You can't use Velocity output anywhere but in the email assembly context. It's never calculated at the flow point you're showing, so even if the red squiggly didn't show there wouldn't be any data.

If you need complex calculations like you can do in Velocity, but need to persist the result permanently to a lead field, you need a webhook solution.

Victor_Herrero
Level 5

Re: Calculate number of years based on a date field

Thank you fr confirming that. I was having a look at a formula field, but it seems they can't be used in smart campaigns and will not be exported. Those would be the main uses I would have for this field...

samsellars
Level 1

Re: Calculate number of years based on a date field

Hello Marketo Experts:

 

In the original post the author says, "The automation sends out an email on the anniversary which is fine (we have built) . . ." 

We are struggling to find a way to populate or using a computed column that holds a date inside Marketo itself.  Not populating the date ourselves with the REST API.  It is nearly the same scenario as this - we need have an anniversary date (birthday in this case) in a column that we can use in a campaign run (trigger).  Would it be possible to run some kind of trigger that would populate the field of all records with the month, day, and current year (birthday)?  Ideally, this would happen on a custom object.

 

Best regards,
Sam

SanfordWhiteman
Level 10 - Community Moderator

Re: Calculate number of years based on a date field


Would it be possible to run some kind of trigger that would populate the field of all records with the month, day, and current year (birthday)?  Ideally, this would happen on a custom object.

Not seeing why you‘d want a Custom Object to store the anniversary of a field (Date of Birth) that itself is a flat field on a person. In any case there’s no way to update COs from flows.

 

You’ll find a couple of options here: https://nation.marketo.com/t5/product-discussions/building-a-birthday-anniversary-email-without-usin...