Search For Eligible Custom Field

Use this endpoint to discover which Custom Fields are eligible for a given template condition — particularly useful when scoping a template to pickup-only or dropoff-only tasks.

URL: https://onfleet.com/api/v2/cfGroups/task/search/fields

The only acceptable field for the payload body is contextSaveConditions

📘

contexSaveConditions

This 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 tasks

Those are the only acceptable values for contextSaveConditionsfield

curl -i -X POST "https://onfleet.com/api/v2/cfGroups/task/search/fields" \
     -u '<your_api_key>:' \
     -d '{"conditions": [{ "fieldName": "pickupTask", "comparison": "equal_to", "targetValue": true}]}'
[
    {
        "asArray": false,
        "contexts":
        [
            {
                "conditions":
                [
                    {
                        "comparison": "equal_to",
                        "fieldName": "pickupTask",
                        "targetValue": true
                    }
                ],
                "isRequired": true,
                "name": "save"
            }
        ],
        "deletedAt": null,
        "description": "",
        "editability":
        [
            "admin",
            "api"
        ],
        "fieldRules":
        [],
        "key": "pickupField",
        "name": "Custom field used only for pickup tasks",
        "type": "single_line_text_field",
        "visibility":
        [
            "admin",
            "api",
            "worker"
        ]
    }
]