Custom field with ID 0 is not on given object

custom-fields

#1

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.


#2

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!


#3

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"
          }
        }
      ]
   }
}

#4

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"
        }
    ]
}

#5

Solved it.

Needed to do the following:

custom_fields: {
    field_id: enum_id
}

#6

Hi Rob,

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


#7

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?


#8

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