Custom field with ID 0 is not on given object

Trying to create a simple task with custom fields, but getting the error message above. The ID im specifiying is from the get custom fields endpoint for my org, so unsure where ID 0 is coming from.

Hey @Evan_Kimia, thanks for reaching out. Sorry to hear you’re having issues.

Can you please provide the code for the request you are making and also the response you are getting so that we can reproduce and the issue?

Thanks!

I am getting the same error:

{
  "data": {
    "assignee": "me",
    "notes": "test",
    "name": "test",
    "workspace": [WORKSPACE_NUMBER],
    "projects": [ PROJECT_NUMBER ],
    "custom_fields": [
        {
          "id": 536734496488696,
          "name": "Github Repo",
          "type": "enum",
          "enum_value": {
            "id": 539321952931050,
            "name": "example",
            "enabled": "true",
            "color": "none"
          }
        }
      ]
   }
}

And here is the error:

{
    "errors": [
        {
            "message": "Custom field with ID 0 is not on given object ",
            "help": "For more information on API status codes and how to handle them, read the docs on errors: https://asana.com/developers/documentation/getting-started/errors"
        }
    ]
}

Solved it.

Needed to do the following:

custom_fields: {
    field_id: enum_id
}
1 Like

Hi Rob,

I tried your solution, but it does not work, can you please give a full example?

What Rob is pointing to is that if the custom field you’re adding is an enum type field, then the value you provide for that field has to be the ID of the enum option you’re wanting to set.

Are you trying to add an enum type field? Does the above explanation help?

Never mind - will reply to the other post you just made which has more detail in it.

1 Like