4

I would like to have a DateTime input field on a "New Task" screen in Cloud Flow Designer. The goal is to have a field where one can input a date and time for the task to create.

I can add a Date input field, but I would like to have a field where the user can input Date and Time (e.g. 05/06/2015 15:29).

If this isn't possible with one field, how can I add a separate Time field (for inputting e.g. 15:29)?

I have the rest of the fields set up, as shown here: Date Field in Flow

I'd like to achieve this as part of a Flow, rather than the "standard" method of creating a New Task (clicking on "New Task" from a record's Page).

Thanks in advance!

5

Dude, I spent 2 weeks researching this. As of Spring 2015, the flow can accommodate both Date + Time values, but the user will have to enter each separately in different input fields and your flow will need convert to a datetime value using DATETIMEVALUE() in a formula. Details below...

One thing I encourage you to watch out for is the time conversion. It doesn't account for the user's time zone! So, if a person enters 3:00PM CST, the DateTimeValue function will store it as 3:00PM UTC!

DATETIMEVALUE Description: Returns a year, month, day and GMT time value. Use: DATETIMEVALUE(expression) and replace expression with a date/time or text value, merge field, or expression. Example: Closed Date DATETIMEVALUE(ClosedDate) displays a date field based on the value of the Date/Time Closed field.

Literal Date Value

DATETIMEVALUE("2005-11-15 17:00:00") returns November 15, 2005 5:00 PM GMT as a date and time value .

Tips: DATETIMEVALUE is always calculated using GMT time zone and can't be changed. When entering a date as a literal value, surround the date with quotes and use the following format: YYYY-MM-DD, that is, a four-digit year, two-digit month, and two-digit day. If the expression does not match valid date ranges, such as the MM is not between 01 and 12, the formula field displays #ERROR!

Adapted from: https://success.salesforce.com/answers?id=90630000000grwLAAQ

1
  • Thanks for the answer which also answered a subsequent problem I wouldn't have understood if you didn't mention it: the time conversion. – Martin Tóth Jun 6 '15 at 7:36
4

"How to Manually Capture Date/Time in VisualFlow"

The idea is to capture date and time as separate value using screen element. Once the values are obtained they need to be combined to get a datetime value.

It is recommended to have the Visual Flow Implementation Guide open while following the below steps so that there is a reference point if there are any questions with regard to various elements used

1) Create a Screen element with Input Textbox for Date with format of YYYY-MM-DD in the textbox field

2) Add another Input Textbox for Time with format HH:MM:SS

**The format should be maintained as it will be required in DATETIMEVALUE() function that will be used later on

**Alternatively, one field can be used with the format "YYYY-MM-DD HH:MM:SS" but having 2 fields will make it more easier for end user

3) Click the Field Settings tab to fill in appropriate information then click OK button

4) Create a formula variable from the Resources tab

5) Assign a unique name e.g. DateAndTime

6) Set value data type to DateTime

7) Use the formula --DATETIMEVALUE({!Date}+" "+{!Time}) then click OK button This essentially calculates the date time as DATETIMEVALUE(YYYY-MM-DD HH:MM:SS)

8) Add a Record Create element from the Palette

9) Type in Name as per requirement

10) Under assignment selected the object where you want this value to be populated by choosing it from the drop downnext to Create

11) Choose the Datetime Field in the page layout

12) Set the Value to the Formula variable created in Step 4, then click OK button

13) Click Save button

14) click Run button

1

I also came up to this big hurdle in Visual Workflow and did some hair pulling for a while, but I did come up with a workaround. Please see the blog post I wrote on how to offer your users a DateTime selection in Visual Workflows.

http://salesforce-tips.blogspot.de/2016/01/salesforce-visual-workflow-with.html

Hope it helps! Please do let me know, if anything doesn't work. I tested it and it worked, but explaining what I did and people following what I wrote is another story.

Scott

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.