UpdateTimesheet
Creates or completely replaces one employee timesheet period.
Stored Procedure-Specific Information
UpdateTimesheet writes a complete timesheet period for one employee. If the period already exists, the procedure completely replaces it. It does not append or merge lines. The LinesJson input must therefore contain every line and entry that should remain in the period; existing lines and entries omitted from the input are removed.
LinesJson must be a JSON array. Each line contains a PayrollCategory UID and an Entries array. Each entry contains a date and the number of hours. A line can also contain a Job UID, Activity UID, Customer UID, and Notes. Entry dates must be within the period defined by StartDate and EndDate.
After saving the period, it retrieves the saved timesheet from the URL returned by MYOB. The result includes the saved lines, line and entry counts, and the timesheet URI.
Example
The following example replaces the complete period with two lines. Replace the sample UIDs with values from your company file.
EXEC UpdateTimesheet
EmployeeUID = '22985a06-eeaa-4634-89ef-ee4ff314f406',
StartDate = '2026-09-21T00:00:00Z',
EndDate = '2026-09-27T00:00:00Z',
LinesJson = '[
{
"PayrollCategory": {"UID": "32517300-897d-49a1-82b4-634fa299e028"},
"Job": {"UID": "12f654da-f142-4bf0-b3b1-81f02fb6b7c3"},
"Notes": "Project work",
"Entries": [
{"Date": "2026-09-21T00:00:00", "Hours": 7.5},
{"Date": "2026-09-22T00:00:00", "Hours": 7.5}
]
},
{
"PayrollCategory": {"UID": "6cbf083b-87ef-4768-a45c-1c07375c9959"},
"Activity": {"UID": "11111111-1111-1111-1111-111111111111"},
"Customer": {"UID": "22222222-2222-2222-2222-222222222222"},
"Notes": "Customer work",
"Entries": [
{"Date": "2026-09-23T00:00:00", "Hours": 4.0}
]
}
]'
Input
| Name | Type | Required | Description |
| EmployeeUID | Uuid | True | The employee whose timesheet is written. |
| StartDate | Datetime | True | The first date of the timesheet period. |
| EndDate | Datetime | True | The last date of the timesheet period. |
| LinesJson | String | True | The complete JSON array of timesheet lines and entries. Optional job, activity, customer, and notes values belong inside each line. |
Result Set Columns
| Name | Type | Description |
| EmployeeUID | Uuid | The employee returned by MYOB. |
| StartDate | Datetime | The saved period start date. |
| EndDate | Datetime | The saved period end date. |
| LinesJson | String | The complete line collection returned by MYOB after the save. |
| LineCount | Integer | The number of saved lines. |
| EntryCount | Integer | The total number of saved entries. |
| URI | String | The saved timesheet URL returned in the PUT Location header. |