SOLVED

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

Go to solution
SanfordWhiteman
Level 10 - Community Moderator

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

It appears you have changed the field type to DateTime successfully, at least for those fields that have a value shown here (if the value is empty you can't tell what the original field type is).

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?

The empty values are supposed to reflect Product X Subscribed = False. I can confirm though that I have changed the datatype from Date to DateTime for all Product X Subscribed Date fields.

I have updated my record (below image) and intentionally left 'Dealer Websites Subscribed' as empty (false) and 'CRM Pro Subscribed Date' as empty to see what we see.

I did notice in spot checking that there are a small number of records in the data base that do, in fact, have current subscriptions but with an empty 'Subscribed DateTime'. I can remedy that with a Smart Campaign for those such records with 'Product X Subscribed' = True AND 'Product X Subscribed Date' is empty to write in some static value I determine just so there is a value there.

Am I on the right track or what do you see I need to still do to get on the right track?

pastedImage_7.png

SanfordWhiteman
Level 10 - Community Moderator

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

Yes, was talking about the empty values for the fields that have "Date" in the name. From the name alone I can't tell you whether those are Dates or DateTimes. Not saying you didn't do the datatype change correctly, merely that I can't confirm that you did using just the screenshot.

You appear to be on the right track overall.

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?

Yes, I unfortunately and dare I say stupidly changed the datatypes without changing the name to reflect DateTime rather than just Date.

That said, I have just now changed the names of the fields from 'Product X Subscribed Date' to 'Product X Subscribed DateTime', however, the email preview is identical to the above screenshot. It didn't change from Date to DateTime in the preview but the proper name is refelected in the Script Token checkbox field tree. What clear and obvious thing am I missing and/or did I do wrong?

SanfordWhiteman
Level 10 - Community Moderator

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

The Velocity property name won't change, you're only changing the friendly name.

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?

So that's correct. I have the datatypes now correctly set. Checkmarked the Script Editor boxes for 'Subscribed' and 'Subscribed DateTime' for each product. Placed the token in an email. previewed-by-list and actually sent the email through a Smart Campaign but when received the token block is completely blank.

It feels like it's sooo close but then again without having comprehensive knowledge I may not even be close yet.

Please let me know of my next step? Here is the complete VTL.

pastedImage_1.png

pastedImage_2.png

pastedImage_3.png

SanfordWhiteman
Level 10 - Community Moderator

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

Pls provide the code in a way that I can test it (text, highlighted as Java).

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?

I've copied it but indents and spacing are off so I've also attached it as is via notepad.

${display.list( $lead.entrySet(), "\u000a" )}
#if( !$lead.DMSSubscribed.isEmpty() )
#set( $calDMSSubscribed = $convert.toCalendar(
$convert.parseDate(
$lead.DMSSubscribed,
$ISO8601,
$defaultLocale,
$defaultTimeZone
)
) )
#if( $date.difference($calNow,$calDMSSubscribed).getHours() >= -24 )
You subscribed to Product X within the past 24 hours.
#end
#end
#if( !$lead.CRMSubscribed.isEmpty() )
#set( $calCRMSubscribed = $convert.toCalendar(
$convert.parseDate(
$lead.CRMSubscribed,
$ISO8601,
$defaultLocale,
$defaultTimeZone
)
) )
#if( $date.difference($calNow,$calCRMSubscribed).getHours() >= -24 )
You subscribed to Product X within the past 24 hours.
#end
#end
#if( !$lead.BHPHSubscribed.isEmpty() )
#set( $calBHPHSubscribed = $convert.toCalendar(
$convert.parseDate(
$lead.BHPHSubscribed,
$ISO8601,
$defaultLocale,
$defaultTimeZone
)
) )
#if( $date.difference($calNow,$calBHPHSubscribed).getHours() >= -24 )
You subscribed to Product X within the past 24 hours.
#end
#end
#if( !$lead.AutoCheckSubscribed.isEmpty() )
#set( $calAutoCheckSubscribed = $convert.toCalendar(
$convert.parseDate(
$lead.AutoCheckSubscribed,
$ISO8601,
$defaultLocale,
$defaultTimeZone
)
) )
#if( $date.difference($calNow,$calAutoCheckSubscribed).getHours() >= -24 )
You subscribed to Product X within the past 24 hours.
#end
#end
#if( !$lead.OAPSubscribed.isEmpty() )
#set( $calOAPSubscribed = $convert.toCalendar(
$convert.parseDate(
$lead.OAPSubscribed,
$ISO8601,
$defaultLocale,
$defaultTimeZone
)
) )
#if( $date.difference($calNow,$calOAPSubscribed).getHours() >= -24 )
You subscribed to Product X within the past 24 hours.
#end
#end
#if( !$lead.DealerWebsitesSubscribed.isEmpty() )
#set( $calDealerWebsitesSubscribed = $convert.toCalendar(
$convert.parseDate(
$lead.DealerWebsitesSubscribed,
$ISO8601,
$defaultLocale,
$defaultTimeZone
)
) )
#if( $date.difference($calNow,$calDealerWebsitesSubscribed).getHours() >= -24 )
You subscribed to Product X within the past 24 hours.
#end
#end
#if( !$lead.CRMProSubscribed.isEmpty() )
#set( $calCRMProSubscribed = $convert.toCalendar(
$convert.parseDate(
$lead.CRMProSubscribed,
$ISO8601,
$defaultLocale,
$defaultTimeZone
)
) )
#if( $date.difference($calNow,$calCRMProSubscribed).getHours() >= -24 )
You subscribed to Product X within the past 24 hours.
#end
#end
#if( !$lead.MaxDigitalSubscribed.isEmpty() )
#set( $calMaxDigitalSubscribed = $convert.toCalendar(
$convert.parseDate(
$lead.MaxDigitalSubscribed,
$ISO8601,
$defaultLocale,
$defaultTimeZone
)
) )
#if( $date.difference($calNow,$calMaxDigitalSubscribed).getHours() >= -24 )
You subscribed to Product X within the past 24 hours.
#end
#end
#if( $lead.DMSSubscribed.equals("") )
Your DMS Subscribed is false.
#end
#if( $lead.CRMSubscribed.equals("") )
Your CRM Subscribed is false.
#end
#if( $lead.BHPHSubscribed.equals("") )
Your BHPH Subscribed is false.
#end
#if( $lead.AutoCheckSubscribed.equals("") )
Your AutoCheck Subscribed is false.
#end
#if( $lead.OAPSubscribed.equals("") )
Your OAP Subscribed is false.
#end
#if( $lead.DealerWebsitesSubscribed.equals("") )
Your Dealer Websites Subscribed is false.
#end
#if( $lead.CRMProSubscribed.equals("") )
Your CRM Pro Subscribed is false.
#end
#if( $lead.MaxDigitalSubscribed.equals("") )
Your Max Digital Subscribed 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't have?

Pls highlight using the Syntax Highlighter as well.

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?

Got it. I never knew how that was done in the community. This has been such an important lesson for me. Thanks. I edited my previous comment.