Getting specific custom fields

I’m trying to pull all the regular fields and also some specific custom fields. I just need the name of the field and the value. Here is the code I am using currently.

tasks = client.tasks.find_by_project(project['gid'], {"opt_expand":"name, \
        projects, workspace, gid, due_on, created_by, created_at, modified_at, completed, \
        completed_at, assignee, tags, custom_fields"}, iterator_type=None)

any thoughts on how to just get some of the custom field names and their corresponding values?

Thanks.

Hi,

Your request does not work? Do you at least see something being sent back to you?

If you see your custom fields in the response, there’s no way to only see some of them.
You always get all in return.

But, if you have too much data, you can specify custom_fields.name, custom_fields.number_value, etc…
Example, if you use “enums”, you may not want to get all available options of your enum on each task! You only want the enum_value, not the enum_options.

Also, if the response is not what you were waiting for, try “opt_fields” instead of “opt_expand”.

1 Like