GID of the custom fields in a task

Hi! I’m trying to automate an Excel spreadsheet by extracting data from Asana with Microsoft Power Automate. I’ve managed to set up a flow so that when a task is closed in Asana, a row is generated in a cloud Excel file on OneDrive with the data from the task. However, I still need to get the data from the custom fields I’ve created, and for that I need to get the GID of the custom fields. I’ve tried to get them using the API but I can’t find a way. Can anyone help me?

Hi,

Sorry, I’m not familiar with Power Automate. But if you have access to make API calls, these calls should give you the custom field values on a specific task (possibly needing task id, but not custom field id).

Get a single task by id
https://app.asana.com/api/1.0/tasks/{task_gid}

Get multiple tasks (maybe not best for your case) and specify custom fields as an optional field with opt_fields.
https://app.asana.com/api/1.0/tasks?opt_fields=custom_fields

Note that custom fields have a lot of information within. So if you know which fields you need, you can specify custom_fields.display_value, etc in a comma separated list. Sample JSON here.

1 Like

@Eloi_Oliveras I would highly encourage you to take advantage of this capability if you can. It allows you to get the values of the custom fields you need right in the task call without having to do additional calls to retrieve values. It also avoids you having to deal with custom field gids at all - which is even more problematic in Excel as by default, Excel’s numeric precision typically chops off the rightmost digit in Asana gids (I figured out a way around that and it’s documented here in the forum but it’s a pain to deal with).