Print this page

How to Manually Capture Date/Time in VisualFlow

Knowledge Article Number 000220205
Description There is no element to capture datetime value directly in a visual flow. How can this be achieved?
Resolution 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 regards to various elements used

1) Create a Screen element with Input Textbox for Date with format of YYYY-MM-DD in the textbox field
User-added image
2) Add another Input Textbox for Time with format HH:MM:SS
User-added image
The format should be maintained as it will be required in DATETIMEVALUE() function that will be used later on

Alternative 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
User-added image
5) Assign a unique name e.g. DateAndTime
User-added image
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
User-added image
9) Type in Name as per requirement
User-added image
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
User-added image
14) click Run button
15) The rest of the images below show a sample record creation and how the date/time field was formulated from the input screen element
checked for records

run screen

input date and time

check for the newly created record

date and time captured

promote demote