How do I bring in customfields using python?

Hello, I’m trying to bring in two custom fields from my Asana board. One is called Title and the other is called Role Location. Here is my python code:

tasks = client.tasks.find_by_project(project_id, {"opt_fields":"name,projects, workspace, gid, due_on, created_at, modified_at, completed, completed_at, assignee, assignee_status, parent, Title, Role Location"})

I keep getting an error saying KeyError:'Title’

Can someone please explain to me how to bring in custom fields, I’ve been researching all day but still can’t seem to bring in any custom fields from my Asana board.

thank you so much.

Hi,

You should refer to the API doc (Asana). In opt_fields you can’t request for specific “custom fields”. Instead you should write custom_fields.gid for example, just like you are mapping the other fields. And then in the answer you’ll get to see all custom fields on the task.

Does this help?

1 Like