Pay Code Actions

Pay code actions serve either one of two purposes:

  1. Associate pay codes with activities - Eliminates the need to enter events for specific activities. For example, if you associate the “Vacation” pay code with the “Vacation” activity, when you enter the "Vacation" pay code as an edit, the timecard creates an event for "Vacation."
  2. Allocate hours in a pay code to multiple projects - As an example, you can distribute employees’ paid time off according to the percentage of hours worked on each project during a pay period. This is called dynamic allocation because the allocation changes whenever entered hours change for the projects in the pay period.

You can associate only hours-based pay codes with pay code actions.

Prerequisites

You must create activities before creating pay code actions.

Example

In this example, we create, verify, update, and delete a pay code action.

Create a pay code action

The create request:

  • creates a new pay code action named: Downtime Hours
  • uses object references to link the Downtime Hours pay code and the Example Downtime activity to this pay code action

Example request

Call the Create Activity Action POST /v1/work/pay_code_actions operation with the following request payload.

{
    "name": "Downtime Hours",
    "payCode": {
        "qualifier": "Downtime Hours"
    },
    "activity": {
        "id": 52,
        "qualifier": "Example Downtime"
    },
    "version": 1,
    "default": false
}

Example response

A success response returns HTTP status code 200 and a response body similar to the following example.

{
    "id": 51,
    "name": "Downtime Hours",
    "payCode": {
        "id": 376,
        "qualifier": "Downtime Hours"
    },
    "activity": {
        "id": 52,
        "qualifier": "Example Downtime"
    },
    "version": 1,
    "default": false
}

Verify

To verify, call the Retrieve Activity Action by ID GET /v1/work/pay_code_actions/{id} or the Retrieve All Activity Actions or by Name GET /v1/work/pay_code_actions?name={name} operation.

Calling GET /v1/work/pay_code_actions/51 or GET /v1/work/pay_code_actions?name=Downtime Hours returns:

{
    "id": 51,
    "name": "Downtime Hours",
    "payCode": {
        "id": 376,
        "qualifier": "Downtime Hours"
    },
    "activity": {
        "id": 52,
        "qualifier": "Example Downtime"
    },
    "version": 1,
    "default": false
}

Note: The Retrieve All Activity Actions or by Name GET /v1/work/pay_code_actions?name=Downtime Hours operation returns the object above enclosed in an array, since omitting the name query parameter returns all pay code actions in the system.

Update the pay code action

To update the pay code action by changing the linked pay code to Downtime and Safety Hours, call the Update Activity Action by ID PUT /v1/work/pay_code_actions/51 operation with the following request payload.

Example request

{
    "id": 51,
    "name": "Downtime Hours",
    "payCode": {
        "qualifier": "Downtime and Safety Hours"
    },
    "activity": {
        "id": 52,
        "qualifier": "Example Downtime"
    },
    "version": 1,
    "default": false
}

Example response

{
    "id": 51,
    "name": "Downtime and Safety Hours",
    "payCode": {
        "id": 372,
        "qualifier": "Downtime and Safety Hours"
    },
    "activity": {
        "id": 52,
        "qualifier": "Example Downtime"
    },
    "version": 2,
    "default": false
}

Note that the version is automatically incremented to 2. To successfully update this pay code action again, you must pass version 2 in the request body.

Delete the pay code action

To delete this pay code action, call the Delete Activity Action by ID DELETE /v1/work/pay_code_actions/51 operation.

The system returns HTTP status 204 with an empty response body.