Result Code Profiles
Result codes define the data that employees can enter into certain pre-defined or custom field definitions. After you create result codes, you group them into result code profiles, and assign them to activity profiles.
Prerequisites
You should create custom field definitions and create result codes before creating result code profiles.
Example
In this example, we create, verify, update, and delete a result code profile.
Create a result code profile
The create request:
- creates a new result code profile named: Scrapped Quantity Codes
- assigns a field definition and result code to the profile
- does not set this result code profile as the system default
Example request
Call the Create Result Code Profile POST /v1/work/result_code_profiles
operation with the following request payload.
{
"name": "Scrapped Quantity Codes",
"description": "Profile containing access to scrapped quantity codes.",
"version": 1,
"fieldDefinitionResultCodeAssignments": [
{
"fieldDefinition": {
"id": -33,
"qualifier": "_Scrapped Quantity Code"
},
"resultCodes": [
{
"id": 2,
"qualifier": "Example Result Code 2"
}
]
}
],
"default": false
}
Example response
A success response returns HTTP status code 200 and a response body similar to the following example.
{
"id": 1,
"name": "Scrapped Quantity Codes",
"description": "Profile containing access to scrapped quantity codes.",
"version": 1,
"fieldDefinitionResultCodeAssignments": [
{
"fieldDefinition": {
"id": -33,
"qualifier": "_Scrapped Quantity Code"
},
"resultCodes": [
{
"id": 2,
"qualifier": "Example Result Code 2"
}
]
}
],
"default": false
}
Verify
To verify, call the Retrieve Result Code Profile by ID GET /v1/work/result_code_profiles/{id}
or the Retrieve All Result Code Profiles by Name GET /v1/work/result_code_profiles?name={name}
operation.
Calling GET /v1/work/result_code_profiles/1
or GET /v1/work/result_code_profiles?name=Scrapped Quantity Codes
returns:
{
"id": 1,
"name": "Scrapped Quantity Codes",
"description": "Profile containing access to scrapped quantity codes.",
"version": 1,
"fieldDefinitionResultCodeAssignments": [
{
"fieldDefinition": {
"id": -33,
"qualifier": "_Scrapped Quantity Code"
},
"resultCodes": [
{
"id": 2,
"qualifier": "Example Result Code 2"
}
]
}
],
"default": false
}
Note: The Retrieve All Result Code Profiles by Name GET /v1/work/result_code_profiles?name=Scrapped Quantity Codes
operation returns the object above enclosed in an array, since omitting the name
query parameter returns all result code profiles in the system.
Update the profile
To update the result code profile, call the Update Result Code Profile by ID PUT /v1/work/result_code_profiles/1
operation with the following request payload.
Example request
{
"id": 1,
"name": "Scrapped and Complete Quantity Codes",
"description": "Profile containing access to scrapped and complete quantity codes.",
"version": 1,
"fieldDefinitionResultCodeAssignments": [
{
"fieldDefinition": {
"id": -33,
"qualifier": "_Scrapped Quantity Code"
},
"resultCodes": [
{
"id": 2,
"qualifier": "Example Result Code 2"
}
]
},
{
"fieldDefinition": {
"id": -6,
"qualifier": "_Completed Quantity Code"
},
"resultCodes": [
{
"id": 4,
"qualifier": "Example Result Code 4"
}
]
}
],
"default": false
}
Example response
{
"id": 1,
"name": "Scrapped and Complete Quantity Codes",
"description": "Profile containing access to scrapped and complete quantity codes.",
"version": 2,
"fieldDefinitionResultCodeAssignments": [
{
"fieldDefinition": {
"id": -33,
"qualifier": "_Scrapped Quantity Code"
},
"resultCodes": [
{
"id": 2,
"qualifier": "Example Result Code 2"
}
]
},
{
"fieldDefinition": {
"id": -6,
"qualifier": "_Completed Quantity Code"
},
"resultCodes": [
{
"id": 4,
"qualifier": "Example Result Code 4"
}
]
}
],
"default": false
}
Note that the version is automatically incremented to 2. To successfully update this profile again, you must pass version 2 in the request body.
Delete the profile
To delete this result code profile, call the Delete Result Code Profile by ID DELETE /v1/work/result_code_profiles/1
operation.
The system returns HTTP status 204 with an empty response body.
Updated over 1 year ago