Create a task with an existing custom Field


Hello asana community,

Currently I am trying to create a task with the api client, it works perfectly until I add the “custom_fields” to the data for the new task.

{‘custom_fields’: ‘{“781306366706886”: “781306366706887”}’,

‘name’: ‘Testing again and again’,

‘projects’: [781714307339766],

‘assignee’: ‘700596286189000’}

“781306366706886” is the custom field Id and the “781306366706887” enum Id.

I have been going around for days, search and tried multiple solutions to similar problems in this community and stack overflow, but none of them have worked.

I appreciate any inputs.


Hmmm, your syntax looks right to me. Are you 100.0% sure those id values are correct, especially the enum id? That’s the id of the specific enum value you’re wanting to set, right?


I just ran one of my unit tests that sets custom fields for a task, and grabbed the JSON I send to the Asana service:

  "name": "Testing",
  "assignee": "159356326117471",
  "custom_fields": {
    "743926788382115": "3.14",
    "744020393575926": "This is some text.",
    "743926788382110": "754688651720395"

743926788382115 is the custom field ID for a number type custom field.
744020393575926 is the custom field ID for a text type custom field.
743926788382110 is the custom field ID for an enum type custom field, and 754688651720395 is the ID for one of the enum values that’s been defined for that field.


Thank you rob.
With the Data above, I get the following response:
Server Error: Oops! An unexpected error occurred while processing this request. The input may have contained something the server did not know how to handle. For more help, please contact and include the error phrase from this response.

And the custom_fields object is this:
“data”: {
“id”: 781306366706886,
“enum_options”: [
“id”: 781306366706887,
“color”: “aqua”,
“enabled”: true,
“name”: “Open”
“id”: 781306366706888,
“color”: “yellow”,
“enabled”: true,
“name”: “In progress”
“id”: 781306366706889,
“color”: “yellow-green”,
“enabled”: true,
“name”: “Closed”
“name”: “Status”,
“type”: “enum”

Custom field with ID 609387761255876 is not on given object

I’m afraid I’m stumped.

@Joe_Trollo, @Matt_Bramlage, any ideas? Does her error message text tell you anything about why she can’t add a custom field to a task? Her syntax looks correct to me.


@carolina, based on your original message,

It looks like you’re passing in a string to this field, when it should be an object. That is, you’re passing in

'custom_fields': '{"781306366706886": "781306366706887"}'

when you should be passing in

'custom_fields': {'781306366706886': '781306366706887'}

Can you confirm the format of the data you’re sending to the API?


Hi Joe,

I corrected the fields and now this is the new data:

{‘name’: ‘I am a new task’,
‘assignee’: ‘700596286189000’,
‘custom_fields’: {‘781306366706886’: ‘781306366706887’},
‘projects’: [781671016689811]

But the response now is:
'Invalid Request: Custom field with ID 781306366706886 is not on given object ’

I appreciate any help!


Based on that message, I suspect that the custom field 781306366706886 is not on the project 781671016689811. In Asana, you can only set a custom field on a task if that task is in a project that has that custom field (or is about to be created in a project that has that custom field).


I can verify that there are no custom fields set on that project.

If you’re looking to do this in the API, you can POST a request to /projects/:project_id/addCustomFieldSetting, which will associate the custom field with the project. Then it should be possible to set the value of the custom field on the task as above.


Can you give me an example of the full request and the full body of an existing custom field?

I am trying also to create a task with an existing custom_fields

Custom field with ID 609387761255876 is not on given object

I never worked with custom fields, maybe @Diakoptis can help?


We’ve moved this discussion over to this other thread:


So If I created a new project, I cannot use the custom_fields already in the workspace?


You can use those custom fields. But you have to assign them to the new project before trying to attach them to tasks in that project. You can do this via the API using the method Matt_Bramlage showed above; or you can do it via the UI using the Manage Custom Fields option on the project menu.


I was able to do it using the client add_custom_field_setting function.
Thank you all for the dedicated responses :blush:!