Clearing custom field of type "people"

Hello,

I am trying to clear a custom field on a task. The custom field has a resource_subtype of people.

If I pass null to the custom field, I get this error.

{
  "errors": [
    {
      "message": "people_value: Object cannot be null",
      "help": "For more information on API status codes and how to handle them, read the docs on errors: https://developers.asana.com/docs/errors"
    }
  ]
}

This only happens on people custom fields. I’m able to clear all other types of custom fields. What’s the recommended approach to blanking out this field on tasks via the API?

I never tried, it might simply be missing as a feature! @Phil_Seeman any idea?

Not sure I’ve tried this, but @Harry_Khanna have you tried passing an empty array instead of null?

Yes, it seems to give an error too, albeit a different error.

Darn. What’s the error in that case?

@Harry_Khanna

Setting the people custom field value to an empty array should clear it. Here’s a sample request that I tested.

curl --location --request PUT 'https://app.asana.com/api/1.0/tasks/<YOUR_TASK_GID>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <YOUR_ASANA_PERSONAL_ACCESS_TOKEN>' \
--data '{
  "data": {
    "custom_fields": {
      "<PEOPLE_CUSTOM_FIELD_GID>": []
    }
  }
}'
1 Like