SOLVED

Re: Change Data Value based on Datetime

Go to solution
Anonymous
Not applicable

Change Data Value based on Datetime

Hi there,

I am trying to populate a custom field with a variable depending on the datetime in a field we have synced from Salesforce. Depending on the date of the Salesforce field, I want the custom field to populate with a specific string, these are different depending on the week.

For some reason this flow step is not working as I would suspect and I think it is due to the datetime field not reading as between these dates. The flow step I have set up is as follows:

pastedImage_1.png

The choices follow on as this so that each lead within each week increment gets a new value. The Segmentation Datetime field also reverts to having "12:00" at the end which I don't want (as I just want leads within these 2 dates inclusive) - I am not sure if this is the cause of my problems.

During testing I could not get the flow to work with separate dates and all leads reverted to choice 1. Does anyone have any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Change Data Value based on Datetime

Yep, the fact that "pod time" is CDT is exactly the reason that almost everyone whose instance time (or, let's say, "corporate HQ time") is not also CDT has potentially broken tokens. I got into that problem a lot in some of my recent posts about Dates and Times in Velocity, but it exists outside of email scripting, too.

Anyway, yes, as long as you calibrate to CDT, you want ranges like yyyy-MM-dd 00:00 - yyyy-MM-dd 23:59. 

View solution in original post

5 REPLIES 5
SanfordWhiteman
Level 10 - Community Moderator

Re: Change Data Value based on Datetime

Datetimes always have times -- if you don't want times, use Date fields (although there are still implicit timezone, and thus time, concerns, they're out of your hands).

Ending at "2016-10-16 12:00" is going to lop off all the matches after 12:00 on 2016-10-16, which isn't what you want, as it's not inclusive of the entire day(s).

If every lead you're running through the flow is matching Choice 1 (which isn't really "reverting," since it's not the default) then I would suspect there's something up with the data that's actually being pushed to Segmentation Datetime.  Can you add {{Lead.Segmentation Datetime}} to an email and post a screenshot of the results for a known lead?

Anonymous
Not applicable

Re: Change Data Value based on Datetime

Thanks Sanford.

The data coming through the field is datetime so presumably I could have 10/10/2016 00:00 to 16/10/2016 23:59? I basically want the increments from Monday to Sunday.

Although I have just added {{lead.Segementation Datetime}} to an email on one of our known leads and I got CDT time:

pastedImage_0.png

This may explain why I was having issues as CDT is still Sunday 9th October.

We can determine the weekly increments based on any timezone we choose (as long as it's consistent) but to do this how would I set up the flow step?

SanfordWhiteman
Level 10 - Community Moderator

Re: Change Data Value based on Datetime

Yep, the fact that "pod time" is CDT is exactly the reason that almost everyone whose instance time (or, let's say, "corporate HQ time") is not also CDT has potentially broken tokens. I got into that problem a lot in some of my recent posts about Dates and Times in Velocity, but it exists outside of email scripting, too.

Anyway, yes, as long as you calibrate to CDT, you want ranges like yyyy-MM-dd 00:00 - yyyy-MM-dd 23:59. 

Anonymous
Not applicable

Re: Change Data Value based on Datetime

Thanks for your help Sanford, that's great

Jon_Wright
Level 4

Re: Change Data Value based on Datetime

Hi @SanfordWhiteman 

I'm having a similar issue with Datetime flow step logic that I was hoping you could help with. I want to send records to a different campaign based on a datetime field, here is my logic:

 

Capture.PNG

 

Here is the value in that field for the lead I am testing with, outputted into an email

Capture 2.PNG

And just to confirm the field is a Datetime field:

Capture 3.PNG

So I would expect this record to skip Choice 1, and be picked up in Choice 2. But it gets picked up in choice 1, any idea what I'm doing wrong here? Your TZ knowledge is always appreciated!