SOLVED

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

Go to solution
Ronn_Burner
Level 4

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!

1 ACCEPTED SOLUTION
SanfordWhiteman
Level 10 - Community Moderator
- 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.

View solution in original post

96 REPLIES 96
SanfordWhiteman
Level 10 - Community Moderator

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

Ronn_Burner
Level 4

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

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

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

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

I have successfully changed the datatype for the custom fields and appropriately checked all the 'Product X Subscribed' (Boolean T/F) and 'Product X Subscribed Date' (DateTime) boxes in the Script Token. I think everything is where it needs to be to move forward now. This is how the preview-by-list appears (below).

Am I missing any other boxes to check and/or where do I need to go from here? Thank you.

pastedImage_1.png

Ronn_Burner
Level 4

That's not exactly what I'm doing but your point may still stand. Let me explain and then advise accordingly.

I am actually not using the Custom Object subscribedOn field in the flow - that field and many having to do with our CRM have been very problematic as it was implemented prior to my arrival with little planning complicating the Marketo integration tremendously.

Rather what I've done is converted the Custom Object into a custom field on the lead record. Just "flattened" out the CO with the custom field 'DMS Subscribed' into a boolean True or False when "Status" (a CO attribute) = 'Subscribed'.

'DMS Subscribed Date' with the token is also a custom field on the lead record - which does work. I believe all of that is done completely correct. As a matter of fact, I'm almost certain this was your solution (I could be wrong though) I found here in the community and built a couple years ago.

Assuming that is correct, and in fact, this is the Smart Campaign rewriting the date every day. So the flow is working. The Smart List is the problem in that it's doing exactly what it is told but am I telling it incorrectly?

Is it scanning every day for ALL records 'Subscribed' to 'Dealer Desktop (DMS)' plus the filters and then pushing them through the flow - which is updating their 'DMS Subscribed Date' with the daily sync? That sure seems to be the case. If so, how can I remedy that? I didn't think this would happen because if the data value is NOT changing in the CRM (after the one time) then it should not sync and overwrite again UNTIL the value changes to "unsubscribed".

What is the difference between the two Custom Objects: "Added to..." and "Has..." - in terms of what action qualifies for each? I created a Trigger campaign for "Added to..." (thinking it meant catching NEW) and this Batch campaign for "Has..." (thinking it was catching UPDATED). One problem I see is in the Campaign Schedule I'm allowing the lead to run through the flow every time - changing that to only once may solve it all. Oh my goodness, can it be that easy?

Please correct me if I'm wrong.

I can see that I can correct all of this as well as properly implement the Velocity that began this conversation I just want to ensure with your guidance I get to the desired result properly.

SanfordWhiteman
Level 10 - Community Moderator

You can't read the field subscribedOn from the Custom Object in a flow, if that's what you mean.  It is not accessible as a token in that context, only in Velocity.

Ronn_Burner
Level 4

Only Filter 1 Has Products Revised and 4 DCID are Custom Objects. Dealership Account Status is a Custom Field. I don't know what you mean in terms of identifying that as being a problem or "thee" problem.  That Smart Campaign should work in my mind by writing the Product X Subscribed Date one time on the day it takes place and it remains that datetime. What do I need to do to accomplish that?

pastedImage_6.png

SanfordWhiteman
Level 10 - Community Moderator

You would start with the seminal post on day/time in Velocity: https://blog.teknkl.com/velocity-days-and-weeks/ 

Ronn_Burner
Level 4

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

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.

Ronn_Burner
Level 4

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.