function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Susan Ross-WentworthSusan Ross-Wentworth 

date/time field in visual flow

Hi,

I have a question for Scott M - SFDC Fan, who posted that great solution about using the offest container and apex (http://salesforce-tips.blogspot.de/2016/01/salesforce-visual-workflow-with.html).  I tried his solution and it worked great in most cases but not all.

It works great for any time values from 10:00 am onward, but will not work for times prior to 10 am.  For example, an input value of 8:30 am results in a calculated date time value which has a three-day offset from my entered date value and a three-hour offset from my entered time (it becomes 11:30 am).  A 9:00 am input value sometimes comes back as 9:00 pm.

I’ve tried various way to get around this but nothing has worked:

The blog mentions using text values of 01:00, 01:15, etc. for the time input values.  I used that format, starting with 08:30, 09:00, 09:30, etc.  When I tried to save the flow, I got an error saying the “SelectionAsNumber” formulas were invalid because of an “incorrect parameter for function “TEXT()”.  Expected Number, Date, DateTime, Picklist, received Text.”

So I changed my time input values to be numbers, starting with 0830, 0900, 0930, 1000, etc.  I used the same “SelectionAsNumber” formulas as before.  Everything then worked beautifully for all time values of 10 am (1000) onward, but not for the times between 8:30 am and 9:30 am (the offset is calculated incorrectly and is off by several days and several hours).

I tried going back to using text for my time input values and took the TEXT() reference out of the “SelectionAsNumber” formulas, leaving everything else the same.  That produces no converted DateTime value at all.

Since everything after 10 am is working, I wish I could just drop the earlier time values, but I have to be able to include them in my input values.

Thanks!!