How can I send 1 email with dynamic content blocks for products they have and products they don't have? | Community
Skip to main content
Level 4
November 10, 2019
Solved

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

  • November 10, 2019
  • 3 replies
  • 12931 views

Here is what I'm being told from above that I need to solve for. I can't figure this out.

Think of our product model as DirecTV. A customer can go online and select (subscribe) to any channel or combination of channels they choose. - - So I have 10 ala carte products and a new subscriber signs up to any 1 single product or any number combination up to all 10 products. I only want ONE email to be sent per new subscriber regardless of how many products they subscribed to at one time. Then I will send a 2nd email later. Is it possible - and practical - to acknowledge each product they subscribed to uniquely with a text block and/or image for each AND a different text block promoting the products they did not subscribe to? And if not, what is the best way to handle this type of situation?

So many questions: 1. Segmentation logic? 2. Snippets, dynamic emails or unique streams or programs? 3. Engagement or Default Programs? 4. How to ensure ONLY 1 email regardless of new subscriptions deploys? 5. Smart campaign total and goal?

Any thoughts and or advice on how to handle this initial entry via new subscribers would be a life saver. Thank you!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

That was the full code - but now I have added those 7 lines of code at the top as well as "Los_Angeles" rather than "New_York" - which I assume is fine.

It's also confusing $lead.DMSSubscribed and $lead.DMSSubscribedDate (and all the other pairs of values). The first is a Boolean ("1" or "" in Velocity). The second is your stringified DateTime, which is the one you need to convert to a Date in Velocity.

If your confused by what I've done just imagine how exponentially more lost I am. And remember, this whole time I felt confident I was doing exactly what you had been advising. Clearly not the case. I feel like I'm stuck in a riddle.

I can read your diagnosis - and on a macro level understand the root of the problem - but I'm unclear of the remedy as there appears to be numerous implications and paths from one to several changes required or any combination thereof.

I'll be succinct and methodical for clarity (mine, not yours ):

- I should only use $lead.DMSSubscribed or $lead.DMSSubscribedDate and not both, right?

- Do I simply just replace all $lead.DMSSubscribed with $lead.DMSSubscribedDate in the code?

- Do I uncheck the $lead.DMSSubscribed box in the Script Token?


- I should only use $lead.DMSSubscribed or $lead.DMSSubscribedDate and not both, right?

Only the DateTime field.

- Do I simply just replace all $lead.DMSSubscribed with $lead.DMSSubscribedDate in the code?

Yes, that is, if you're going to convert a stringified DateTime (i.e., ISO8601 format) field into a Date, that's where you use the DateTime.

However I don't think these are ISO8601 "yyyy-MM-dd'T'HH:mm:ss".  They're actually ISO8601 "yyyy-MM-dd HH:mm:ss". That is, they have a space instead of the letter "T". So you can add this line to the code at the top:

#set( $ISO8601WithSpace = "yyyy-MM-dd HH:mm:ss" )

Then use $ISO8601WithSpace where you're using $ISO8601 now.

Parsing a String to a Date requires that you tell Velocity (actually Java) all the parts of the format.

- Do I uncheck the $lead.DMSSubscribed box in the Script Token?

For clarity, yes, but it's harmless to leave it checked as you won't be using it. Leaving it unchecked means it will always have the value null. That may be more or less confusing if you accidentally use it, I don't know.

3 replies

RonnBuAuthor
Level 4
November 10, 2019

@Jay Jiang

You have saved my life before so I always like to check in with you to set me straight.

Jay_Jiang
Level 10
November 10, 2019

As Sandford says, use a velocity script that dynamically adds blocks of text if respective checkbox is ticked.

To have the email sent once, I assume your sign up form triggers a Filled out Form or Person is pushed to Marketo trigger? Send the email in the flow of that smart campaign.

RonnBuAuthor
Level 4
November 11, 2019

I responded to Sanford below and as you can see, sadly, I'm not going to be able to do this without a significant amount of help. I'm sure this is not a part of your job description and I'm aware it's asking a lot. I would certainly understand if either of you weren't interested in helping me.

Now knowing velocity is the answer this is no longer an issue. My trigger would be based on the Data Value Change of PRODUCT A SUBSCRIBED = TRUE and in the flow (or stream if this becomes Engagement Program) it would just send the 1 email.

SanfordWhiteman
Level 10
November 10, 2019

What is a product subscription stored as? An individual Boolean? An individual DateTime? An entry in a semicolon-delimited list?

RonnBuAuthor
Level 4
November 10, 2019

Individual boolean custom field per product. I have a custom CRM so was previously required to make those fields to utilize in other Up-sell program and get away from "Added to" and "Has updated" custom object world.

SanfordWhiteman
Level 10
November 10, 2019

This isn't a case for segmentations, then. Too many permutations. (Even if you could precompute them, you don't have enough segments.)

The answer: Velocity. VTL can easily check the value of a Boolean. (Many of my blog posts are about working with Boolean/Boolean-like/once-Boolean values, since it's the most important datatype to understand when using #if!)

Joke_Van_Essche
Level 2
November 15, 2019

@Ronn Burner Thanks for this topic!   

@Sanford Whiteman‌ Is it possible to do the same with program membership instead of a boolean field? So: If Member Status = Registered in Program 1, then "welcome to session 1". If Member Status = Registered in Program 2, then "welcome to session 2". 

SanfordWhiteman
Level 10
November 15, 2019

Unfortunately no. Program membership is not a direct property of the lead.

If you used program membership to manage a segmentation, then the segment is a property of the lead (so could be used in personalization) but it's not updated in absolutely real-time.

Or have a field on the lead that's used as a mirror for their program status.