Create Time Entries

You can use the timeRecordEventRequests resource to create any time entry. If a time card doesn't already exist, the process creates it as well.

The following figure shows that you can use the API to import data from an external time reporting application to, for example, clear exceptions.

The figure explains the data transfer between an external time collection device and the Time and Labor application.

The worker Tom was assigned a work schedule with the 8:00 AM to 5:00 PM shifts for Monday through Friday. A time card with the status Saved already exists for Tom, for the current week. On Monday through Thursday, Tom reports time from 08:00 AM to 05:00 PM, as expected, with the Regular Hours payroll time type. On Friday, Tom forgets to report his time, so his time and labor manager imports Tom's missing time using the REST service. The imported time entry has this information.

Resource Field Value

Start Time

08:00 AM

End Time

05:00 PM

Payroll Time Type

Regular Hours

processMode

TIME_SUBMIT

The process submits the time card for approval as part of the import.

This table shows the prerequisite Time and Labor configuration required to support this scenario.

Configuration Purpose

Manage Layout Sets

Define a layout set where the layouts include a time entry field for payroll time types.

Manage Worker Time Entry Profiles

Define a worker time entry setup profile that includes the preceding layout set and assign the profile to the worker.

This table describes the application processing applied to the imported entry.

Time Record Event Request Application Processing

The manager sends the request for the time entry missing from the worker's time card.

  1. Imports the time record event request using the REST web service.
  2. Runs the Process Imported Entries process to add the imported entry to the worker's time card.

Example URL

The following is the format of the resource URL.

POST

/hcmRestApi/resources/11.13.18.05/timeRecordEventRequests/

Example Request

The following is an example of the request body in JSON format.

 {
"processInline": "N",
"processMode": "TIME_SUBMIT",
"timeRecordEvent":
[{
"startTime":"2017-10-02T08:00:00.000-08:00",
"stopTime":"2017-10-02T17:00:00.000-08:00",
"reporterIdType":"PERSON",
"reporterId":"955160008184353",
"comment":"Missing entry due to clock down",
"operationType":"ADD",
"timeRecordEventAttribute":
[{
"attributeName":"PayrollTimeType",
"attributeValue":"ZOTL_Regular"
}]
}]
}

Tom's manager can review the imported time entry on either the Manage Time Entries or Manage Time Cards page. Note that the application processing also submitted the time card for approval.

Example Response

The following is an example of the response body in JSON format.

{
    "timeRecordEventRequestId": 300100272612162,
    "processMode": "TIME_SUBMIT",
    "processInline": "N",
    "timeRecordEvent": [
        {
            "comment": "Missing entry due to clock down",
            "crudStatusValue": 0,
            "personId": "300100074978533",
            "referenceDate": null,
            "reporterId": "955160008184353",
            "reporterIdType": "PERSON",
            "startTime": "2017-10-02T08:00:00.000-08:00",
            "stopTime": "2017-10-02T17:00:00.000-08:00",
            "subresourceId": null,
            "timeRecordEventId": 300100272612163,
            "timeRecordEventRequestId": 300100272612162,
            "timeRecordId": null,
            "timeRecordVersion": null,
            "operationType": "ADD",
            "assignmentNumber": null,
            "eventStatusValue": 5,
            "eventStatus": "COMPLETE",
            "measure": null,
            "changeReason": null,
            "timeRecordEventAttribute": [
                {
                    "timeAttributeFieldId": 300100028326158,
                    "timeRecordEventAttributeId": 300100272612164,
                    "timeRecordEventId": 300100272612163,
                    "attributeValue": "ZOTL_Regular",
                    "attributeName": "PayrollTimeType",
                    "changeReason": null,
                    "links": [
                        {
                            "rel": "self",
                            "href": "https://<host>:<port>/hcmRestApi/resources/11.13.18.05/timeRecordEventRequests/300100272612162/child/timeRecordEvent/300100272612163/child/timeRecordEventAttribute/300100272612164",
                            "name": "timeRecordEventAttribute",
                            "kind": "item",
                            "properties": {
                                "changeIndicator": "ACED0005737200136A6176612E7574696C2E41727261794C6973747881D21D99C7619D03000149000473697A65787000000001770400000001737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000178"
                            }
                        },
                        {
                            "rel": "canonical",
                            "href": "https://<host>:<port>/hcmRestApi/resources/11.13.18.05/timeRecordEventRequests/300100272612162/child/timeRecordEvent/300100272612163/child/timeRecordEventAttribute/300100272612164",
                            "name": "timeRecordEventAttribute",
                            "kind": "item"
                        },
                        {
                            "rel": "parent",
                            "href": "https://<host>:<port>/hcmRestApi/resources/11.13.18.05/timeRecordEventRequests/300100272612162/child/timeRecordEvent/300100272612163",
                            "name": "timeRecordEvent",
                            "kind": "item"
                        },
                        {
                            "rel": "lov",
                            "href": "https://<host>:<port>/hcmRestApi/resources/11.13.18.05/timeRecordEventRequests/300100272612162/child/timeRecordEvent/300100272612163/child/timeRecordEventAttribute/300100272612164/lov/HcmLookupPVO1",
                            "name": "HcmLookupPVO1",
                            "kind": "collection"
                        }
                    ]
                }
            ],
            "links": [
                {
                    "rel": "self",
                    "href": "https://<host>:<port>/hcmRestApi/resources/11.13.18.05/timeRecordEventRequests/300100272612162/child/timeRecordEvent/300100272612163",
                    "name": "timeRecordEvent",
                    "kind": "item",
                    "properties": {
                        "changeIndicator": "ACED0005737200136A6176612E7574696C2E41727261794C6973747881D21D99C7619D03000149000473697A65787000000001770400000001737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000178"
                    }
                },
                {
                    "rel": "canonical",
                    "href": "https://<host>:<port>/hcmRestApi/resources/11.13.18.05/timeRecordEventRequests/300100272612162/child/timeRecordEvent/300100272612163",
                    "name": "timeRecordEvent",
                    "kind": "item"
                },
                {
                    "rel": "parent",
                    "href": "https://<host>:<port>/hcmRestApi/resources/11.13.18.05/timeRecordEventRequests/300100272612162",
                    "name": "timeRecordEventRequests",
                    "kind": "item"
                },
                {
                    "rel": "lov",
                    "href": "https://<host>:<port>/hcmRestApi/resources/11.13.18.05/timeRecordEventRequests/300100272612162/child/timeRecordEvent/300100272612163/lov/HcmLookupPVO1",
                    "name": "HcmLookupPVO1",
                    "kind": "collection"
                },
                {
                    "rel": "child",
                    "href": "https://<host>:<port>/hcmRestApi/resources/11.13.18.05/timeRecordEventRequests/300100272612162/child/timeRecordEvent/300100272612163/child/timeRecordEventMessage",
                    "name": "timeRecordEventMessage",
                    "kind": "collection"
                },
                {
                    "rel": "child",
                    "href": "https://<host>:<port>/hcmRestApi/resources/11.13.18.05/timeRecordEventRequests/300100272612162/child/timeRecordEvent/300100272612163/child/timeRecordEventAttribute",
                    "name": "timeRecordEventAttribute",
                    "kind": "collection"
                }
            ]
        }
    ],
    "links": [
        {
            "rel": "self",
            "href": "https://<host>:<port>/hcmRestApi/resources/11.13.18.05/timeRecordEventRequests/300100272612162",
            "name": "timeRecordEventRequests",
            "kind": "item",
            "properties": {
                "changeIndicator": "ACED0005737200136A6176612E7574696C2E41727261794C6973747881D21D99C7619D03000149000473697A65787000000001770400000001737200116A6176612E6C616E672E496E746567657212E2A0A4F781873802000149000576616C7565787200106A6176612E6C616E672E4E756D62657286AC951D0B94E08B02000078700000000178"
            }
        },
        {
            "rel": "canonical",
            "href": "https://<host>:<port>/hcmRestApi/resources/11.13.18.05/timeRecordEventRequests/300100272612162",
            "name": "timeRecordEventRequests",
            "kind": "item"
        },
        {
            "rel": "child",
            "href": "https://<host>:<port>/hcmRestApi/resources/11.13.18.05/timeRecordEventRequests/300100272612162/child/timeRecordEvent",
            "name": "timeRecordEvent",
            "kind": "collection"
        }
    ]
}