API Custom Field issues


#1

Frustrated with PUT’ing custom fields. I’m using javascript (google script).

As per:
[https://stackoverflow.com/questions/41257621/updating-a-custom-field-using-asana-python-api/41271324#41271324]

and another thread I found and now can’t find again in which you say an “obscure” bug was found.

the root issue is that API isn’t symmetrical so can’t FETCH and PUT a task (the JSON exactly as it’s FETCHed) without a “Value cannot be an array error” as custom fields are not expected to be an array when posted for some reason

but in trying to workaround by only updating the custom field rather than the whole task with {‘data’: {‘custom_fields’: id : new-value}} using the id I get from FETCHing the task I get “Custom field with ID id is not on given object”, I can’t figure out what’s going on there.

Be great to see some working javascript to FETCH a task, change a custom field value and PUT it.

Thanks


#2

What I can say is that fetching data gives you object like {id:X} while pushing data needs to push only the id. Does it help?
cc @Diakoptis who is the best at API stuff :stuck_out_tongue:


#3

Thanks, not to worry I sorted it


#4

How? :stuck_out_tongue: share your solution for others :wink: