Result Codes
Result codes define the data that employees can enter into certain pre-defined or custom field definitions.
Prerequisites
If you do not plan to use pre-existing field definitions, you must create custom field definitions before creating result codes.
Example
In this example, we create, verify, update, and delete a result code.
Create a result code
The create request:
- creates a new result code named: Example Result Code 1
- uses an object reference to link the Scrapped Quantity Code field definition to this result code
- sets the result code as active
Note: You must specify a field definition that supports result codes.
Example request
Call the Create Result Code POST /v1/work/result_codes
operation with the following request payload.
{
"name": "Example Result Code 1",
"description": "An example result code.",
"active": true,
"version": 1,
"fieldDefinition": {
"id": -33,
"qualifier": "_Scrapped Quantity Code"
}
}
Example response
A success response returns HTTP status code 200 and a response body similar to the following example.
{
"id": 1,
"name": "Example Result Code 1",
"description": "An example result code.",
"active": true,
"version": 1,
"fieldDefinition": {
"id": -33,
"qualifier": "_Scrapped Quantity Code"
}
}
Verify
To verify, call the Retrieve Result Code by ID GET /v1/work/result_codes/{id}
operation or the Retrieve All Result Codes GET /v1/work/result_codes
operation to return all result codes in the system.
Calling GET /v1/work/result_codes/1
returns:
{
"id": 1,
"name": "Example Result Code 1",
"description": "An example result code.",
"active": true,
"version": 1,
"fieldDefinition": {
"id": -33,
"qualifier": "_Scrapped Quantity Code"
}
}
Update the result code
To update the result code by changing its state to inactive, call the Update Result Code by ID PUT /v1/work/result_codes/1
operation with the following request payload.
Example request
{
"id": 1,
"name": "Example Result Code 1",
"description": "An example result code.",
"active": false,
"version": 1,
"fieldDefinition": {
"id": -33,
"qualifier": "_Scrapped Quantity Code"
}
}
Example response
{
"id": 1,
"name": "Example Result Code 1",
"description": "An example result code.",
"active": false,
"version": 2,
"fieldDefinition": {
"id": -33,
"qualifier": "_Scrapped Quantity Code"
}
}
Note that the version is automatically incremented to 2. To successfully update this result code again, you must pass version 2 in the request body.
Delete the result code
To delete this result code, call the Delete Result Code by ID operation: DELETE /v1/work/result_codes/1
.
The system returns HTTP status 204 with an empty response body.
Updated over 1 year ago