How to create or update a task with custom fields
Task Custom Fields is designed to offer enhanced configurability to a task. With this feature, users gain the capability to create order forms according to specific requirements. The flexibility extends to field labeling, empowering customers to designate these fields as they deem fit. Through API integration, developers can seamlessly incorporate and manipulate these features.
You will required to have Custom Fields configured on the Onfleet Dashboard prior to interacting with it using the API. Please see our Support Page Article on how to configure Custom Fields. Customer Fields cannot be created nor updated from the API. All operations describe here is attached to the Task JSON Object as customFields
Request Fields:
Name | Type | Description |
---|---|---|
Key | String | Unique identifier. |
Value | Object | The desired value for this field. |
"customFields": [
{
"key": "newTest",
"value": 1234
},
{
"key":"test",
"value":"order 123"
}
]
"customFields": [
{
"description": "this is a test",
"asArray": false,
"visibility": [
"admin",
"api",
"worker"
],
"editability": [
"admin",
"api"
],
"key": "test",
"name": "test",
"type": "single_line_text_field",
"contexts": [
{
"isRequired": false,
"conditions": [],
"name": "save"
}
],
"value": "order 123"
},
{
"description": "9000",
"asArray": false,
"visibility": [
"admin",
"api",
"worker"
],
"editability": [
"admin",
"api"
],
"key": "newTest",
"name": "newTest",
"type": "integer",
"contexts": [
{
"isRequired": false,
"conditions": [],
"name": "save"
}
],
"value": 1234
}
]
Key
The Custom Value Key is case-sensitive and must be an exact match for the key as configured within the Dashboard. If there is a mismatch with the Key, the API request will still go through, but the mismatched customFields entry will not be added.
Here is what each response fields value means:
Name | Type | Description |
---|---|---|
description | String | Short text describes what the custom field represent. This is set in the Dashboard setting. |
asArray | boolean | If this custom field represent an array of items. |
visibility | array of String | Determines who can view the custom field. This is set in the Dashboard setting. |
editability | array of String | Controls who can edit the custom field. This is set in the Dashboard setting. |
key | String | Serves as a unique identifier for the custom field, more specifically used in API. |
name | String | Friendly name for the custom field. |
type | String | Specifies the data type of the custom field. Valid types are single_line_text_field , multi_line_text_field , boolean , integer , decimal , date ,Url . This is set in the Dashboard setting. |
context | Object | Additional conditions set in the Dashboard setting. |
value | enum | The actual value of the custom field. |