Add a variable for the DateTime input
- Last UpdatedJan 21, 2026
- 3 minute read
Because of a difference in how Work Tasks and MES Stateless API methods treat DateTime inputs, you must create a DateTime variable to convert any DateTime input values from the workflow form from UTC time to local time. For additional information about this issue, refer to DateTime.
This test procedure includes a required finish time input in the workflow form. To address the DateTime issue for this input, the DateTime variable called reqfinishtimevar will be added to the Start activity.
Add the reqfinishtimevar variable to the Start activity
-
With the Job.Add workflow opened, right-click the Start activity and select Activity Properties.
The Activity Properties pane appears.
-
On the Activity Properties pane, select the Variables box button.
The Variables window appears.
-
In the Workflow Variables box, enter reqfinishtimevar.
-
In the Type list, select date.

-
Select Update to save the entries and close the window.
-
In the Activity Properties pane, select the Initialize Variables box button.
The Update Variable window appears.

-
In the Condition column, hover the pointer over Select and select the list box that appears.
A navigation tree appears.
-
Expand the Variables branch and select the Variable.reqfinishtimevar entry.

A row for the reqfinishtimevar variable is added to the table in the Update Variable window.

-
Select the Tree icon under the Actions column.
A list box appears in the Value column.
-
Select the list box button. A navigation tree appears.

-
Select the Build Expression link.
The Expression Editor window appears.
-
In the Editor pane, enter Convert.ToDateTime(.
Note that expression entries are case sensitive.
-
In the navigation tree, expand the Workflow Instance, XmlVariables, SFFormData, and SKRootDefinition branches.
-
Select and drag the entry req_finish_time_local to the right of the opening parenthesis in the expression.
The XML variables object is added to the Editor pane.

-
Complete the entry in the Editor pane so that the full entry is as follows:
Convert.ToDateTime(XmlVariables.SFFormData.
SKRootDefinition.req_finish_time_local,System.Globalization.CultureInfo.InvariantCulture).
ToLocalTime()
-
Select OK and then select Close to close the Variable Editor window.
The completed reqfinishtimevar variable definition appears in the Update Variable window.

-
Select the OK to close the Update Variable window.
-
Select the Save button at the bottom of the Activity Properties pane to save the reqfinishtimevar variable.