Task Custom Fields

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:

NameTypeDescription
KeyStringUnique identifier.
ValueObjectThe 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:

NameTypeDescription
descriptionStringShort text describes what the custom field represent. This is set in the Dashboard setting.
asArraybooleanIf this custom field represent an array of items.
visibilityarray of StringDetermines who can view the custom field. This is set in the Dashboard setting.
editabilityarray of StringControls who can edit the custom field. This is set in the Dashboard setting.
keyStringServes as a unique identifier for the custom field, more specifically used in API.
nameStringFriendly name for the custom field.
typeStringSpecifies 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.
contextObjectAdditional conditions set in the Dashboard setting.
valueenumThe actual value of the custom field.