SOLVED

Re: How can I send 1 email with dynamic content blocks for products they have and products they don'

Go to solution
Ronn_Burner
Level 4

Re: How can I send 1 email with dynamic content blocks for products they have and products they don't have?

And problem solved. Thank you, Sir!

Ronn_Burner
Level 4

Re: How can I send 1 email with dynamic content blocks for products they have and products they don'

Hi @SanfordWhiteman I ran into something here and hoped you could help.

 

We created this VTL for all product subscriptions via lead.DMSSubscribedDate (The value is actually DateTime as I edited those fields) and it works perfectly. All "true" values within past 24 hours reflected and all "false" values data appropriately affected as well.

The monkey wrench is all of these products also offer a Free Trial - which is obviously a different status so I duplicated the VTL appropriately and created and lead.DMSTrialDateTime and that VTL token and programs work perfectly as well.

 

The problem I have created and need to solve for is the fact that it is possible to "Subscribe" to Product01 and begin a "Free Trial" for Product02. The "New Subscriptions Program" will send the Email with the {{RecentlySubscribedProducts}} token only recognizing T or F for "Subscriptions" and therefore populating Product02 as a product you still need - even though you currently have a "Free Trial. 

Likewise the "New Free Trials Program" will send the Email for that program with {{NewProductTrials}} token that will acknowledge a "Free Trial" TRUE for Product02 but recognize Product01 "Free Trial" as FALSE even though it's actually a "Subscribed" product. As it should with those 2 separate VTL scripts.

Do you know how I can solve for this using Smart Campaigns?

The Program looks like this and is duplicated for each Subscribed program and entire sequence duplicated for each Free Trial program:

NEW SUBSCRIPTIONS (default program) - 7 of these so 1 for each product subscription

Smart Campaign: Data Value Changes (trigger): Attribute: DMS Subscribed DateTime in past 24 hours

Flow: Change Program Status: Member

SENDER (default program)

Smart Campaign #1 to send Email #1 (Welcomes TRUE and Promotes FALSE values)

Smart List: (1 or 2 or 3 or 4 or 5 or 6 or 7)

1-Data Value Changed: DMS Subscribed DateTime in past 24 hours --> Flow: Send Subscribed Email #1.

repeat for all products

 

Smart Campaign #2 to send Email #2 (Only promotes FALSE values)

Smart List: 1 and (2 or 3 or 4 or 5 or 6 or 7 or 😎

1-Was Sent Email: Email #1 in past 2 days

2-Member of Program: False / Program is Product01 (DMS)

repeat for all products

 

I know this is confusing but hopefully I articulated clearly enough and you know precisely how to solve for this using Smart Campaign logic that would only send Email #1 from "Subscribed" and not from "Free Trial" in the same day. #If so, please share. Thank you so much

Ronn_Burner
Level 4

Re: How can I send 1 email with dynamic content blocks for products they have and products they don'

@SanfordWhiteman  is there a line of VTL or a way to use "AND" conditions in the script?

 

The reason for this is that a customer can "Subscribe" or begin a "Free Trial" with PRODUCT A (or any of our products). Obviously, the DateTime fields need to be unique for each "PRODUCT X Free Trial" or "PRODUCT X Subscription".

 

Therefore if I want to send Email #2 (Email #1 populates only Trial/Subscription that are TRUE in past 24 hours) to populate only the FALSE values (products they are currently not subscribed to AND not in a Free Trial.

 

So if: "Product A Subscription DateTime" is FALSE (empty) AND "Product A Free Trial DateTime" is FALSE (empty) THEN populate with "Product A is FALSE so TRY NOW!" text.

 

If so, can you please help me with this?

SanfordWhiteman
Level 10 - Community Moderator

Re: How can I send 1 email with dynamic content blocks for products they have and products they don'

Velocity supports the usual C-style boolean and - &&. (It also supports the more primitive AND but that's not good for learning to code.)

 

#if( $field1.equals("something") && $field2.equals("something else") )
## both conditions are true
Ronn_Burner
Level 4

Re: How can I send 1 email with dynamic content blocks for products they have and products they don'

This is great! I understand exactly what you are doing with the script conceptually - but technically I'm not exactly sure how to execute it properly. I have exactly how I interpreted your message below. I did create a token with the below VTL and sent a test send from Lead Record > Marketing > Send Email and it returned no text where Your Product X Subscribed and Trial is false. should be displayed. Yes, I have checked the two corresponding DateTime boxes and used the appropriate system names in the VTL. Please grade my paper, Good Sir.

 

For example, do I literally use "something" and "something else"? And is ##both conditions are true required VTL - I know ## signifies comment but not sure if that is comment for me or comment text location for consumer and the place I should write the text... Your Product X Subscribed and Trial is false.

 

 

 

#set( $ISO8601WithSpace = "yyyy-MM-dd HH:mm:ss" )
#set( $defaultTimeZone = $date.getTimeZone().getTimeZone("America/Los_Angeles") )
#set( $defaultLocale = $date.getLocale() )
#set( $calNow = $date.getCalendar() )
#set( $ret = $calNow.setTimeZone($defaultTimeZone) )
#set( $calConst = $field.in($calNow) )
#set( $ISO8601 = "yyyy-MM-dd'T'HH:mm:ss" )
#set( $ISO8601DateOnly = "yyyy-MM-dd" )
#if( $lead.dMSTrialDateTime.equals("something") && $lead.dMSSubscribedDate.equals("something else") )
## both conditions are true
Your Product X Subscribed and Trial is false.
#end

 

 

 

 

 

 

SanfordWhiteman
Level 10 - Community Moderator

Re: How can I send 1 email with dynamic content blocks for products they have and products they don'


For example, do I literally use “something” and “something else”?


No, those are just placeholders for the conditions you want to match!

 

.equals("something") is a case-sensitive match on a Marketo String or Text field. 

 

.equals("1") would match on a Marketo Boolean field set to true (surfaced as a String "1" in Velocity). I don’t know what you want to do here, it’s all up to your business requirements.

 


And is ##both conditions are true required VTL - I know ## signifies comment but not sure if that is comment for me or comment text

A comment for you, to show the state when you’re inside the #if.

Ronn_Burner
Level 4

Re: How can I send 1 email with dynamic content blocks for products they have and products they don'



No, those are just placeholders for the conditions you want to match!

Oh, man. Buzzkill. Because literally "something" and "something else" is exactly what I need to identify - but in a DateTime field. Basically, for my use case only (empty field values) "null" and "null" = FALSE (does not have Product X Trial or Subscription) and anything else, any value in either field, would indicate TRUE.

FALSE = promote that product because lead does not have product Trial or Subscription

TRUE = skip because lead currently has product Trial or Subscription

Is there a way to do this based on the information I provided and with DateTime "null" and "null" or "null" and "not null"?

If not, I don't think I can do this utilizing VTL as this entire script you and I (you!) created here is based on DateTime.

 

SanfordWhiteman
Level 10 - Community Moderator

Re: How can I send 1 email with dynamic content blocks for products they have and products they don'

$lead.field.isEmpty() checks for an empty String, as does $lead.field.equals("").

Ronn_Burner
Level 4

Re: How can I send 1 email with dynamic content blocks for products they have and products they don'

That worked to perfection! This is amazing stuff. I always make this so much harder than I need to. But, yes, I see. And it worked!

 

Of course, now that I know I can create AND (&&) conditions, is it just as easy to create ANY or OR conditions?

Currently, I have separate programs for Product X Subscribed and Trial - which triggers an email #1 for each - one with theTrialDateTime token and the other with the SubscribedDateTime token.

With ANY or OR conditions (in past 24 hrs) I would be able to have only a single program per product and a single email #1 recognizing any new subscription OR trial.

 

Email #1 - Congratulate all NEW Subscriptions OR Trials (DateTime in past 24 hrs = TRUE) AND promote to all Product X Trial AND Subscription (DateTime is empty) = FALSE

Email # 2 - Only promote to all Product X Trial AND Subscription (DateTime is empty) = FALSE

 

As always, thank you!

 

SanfordWhiteman
Level 10 - Community Moderator

Re: How can I send 1 email with dynamic content blocks for products they have and products they don'

For boolean OR, use the multi-language standard, the double pipe:

 

  ||

 

Velocity also supports literal OR but that's bad for learning cross-language syntax.