This is a POST request
This is to create Task Templates that may only include the configured Custom Fields.
| Name | Type | Description |
|---|---|---|
| name | string | Required. The Name of the Task Template, unique identifier. |
| contextSaveConditions | object | Required. Please see below for further explanation. |
| fields | array of strings | Required. An array of Custom Fields keys. They have to match exactly to the conditions in contextSaveConditions |
contexSaveConditionsThis field is to set up what type tasks the template can be applied to. The choices are pickup, dropoff, or both.
[]for both types[{ "fieldName": "pickupTask", "comparison": "equal_to", "targetValue": true }]for Only pickup tasks[{ "fieldName": "pickupTask", "comparison": "equal_to", "targetValue": true }]for Only drop-off tasksThose are the only acceptable values for
contextSaveConditionsfield
fieldsIf a template is set to apply only to Pickup tasks, the included Custom Fields must have the same designation; the CF cannot be for only Dropoff tasks. In addition, if a Task template is set up for both types of Tasks, it cannot include CFs that are only for pickup or only for dropoff.
curl -i -X POST "https://onfleet.com/api/v2/cfGroups/task" \
-u '<your_api_key>:' \
-d '{"name": "test templates 2","contextSaveConditions": [{"fieldName": "pickupTask","comparison": "equal_to","targetValue": true}],"fields": ["test"]} '{
"id": "GpKsCxloxkvsdT16tcxRnwZ0",
"name": "test templates 2",
"deletedAt": null,
"contextSaveConditions": [
{
"fieldName": "pickupTask",
"comparison": "equal_to",
"targetValue": true
}
],
"fields": [
"test"
],
"isDefault": false
}
Create Tasks with Custom TemplatesOnce a Custom Template is created, in order to create a Task using that template, the template ID and the fields values will need to be included. For more information, please see [WIP] Creating Tasks with Custom Task Templates
