How to get the actual number values being used in custom fields of tasks in a project?

When I use Asana’s basic Get Project request, it generates a list of custom fields, however, it doesn’t provide the specific values that in each custom field.

For example, using Asana’s guide here:

I make a request with:
https://app.asana.com/api/1.0/projects/ProjectID

it returns this:

       {
        "gid": "123",
        "custom_field": {
          "gid": "123",
          "name": "Name",
          "precision": 0,
          "resource_subtype": "number",
          "resource_type": "custom_field",
          "type": "number",
          "is_formula_field": false
        },

This response doesn’t include the actual value that we have listed in this custom field.

How would I get something like this where the response provides the actual dynamic “10” value that’s being used/inputted by the user in this specific Asana custom field on the front-end?

          "name": "Name",
          "precision": 0,
          "resource_subtype": "number",
          "resource_type": "custom_field",
          "type": "number",
          **"value":"10",**

I’ve tried using different suggested queries like opt_fields=custom_fields.number_value’ but nothing returns the actual number value being used in this field.

@Paul_Curtin,

Using your endpoint, you’ll get project-level custom fields (which are defined in portfolios the project is in) for the project you specify.

To do so, include opt_fields=custom_fields to return the custom_fields array with an entry for each custom field.

custom_fields[n].display_value shows a text version of any type of custom field; for the typed value, see the custom_fields entry (scroll) at Projects.

Thanks,

Larry

Hey Larry,

When I use this CURL example: https://app.asana.com/api/1.0/projects/120?opt_fields=custom_fields’

I get this response that doesn’t include any custom field values:

{
  "data": {
    "gid": "120...",
    "custom_fields": []
  }
}

Adding .display_value to the end of the URL like ‘https://app.asana.com/api/1.0/projects/120?opt_fields=custom_fields.display_value’ produces the same results where I don’t see the custom fields or their values:

{“data”:{“gid”:“120…”,“custom_fields”:}}

What am I doing wrong?

Are you sure that the project is a portfolio that has at least one custom field specified, and that this project sets some value for that custom field?

If not, I’d expect the result you’re getting.

Hope that makes sense,

Larry

I don’t believe it’s a Portfolio. Not sure how to do that… is that a requirement for pulling custom field values?

Right now, we have it setup as a basic Asana Project with tasks added within the Project. The custom fields are added within each Task where our users can manually input numeric values.

Within this test Task, we have custom fields with numerical data added… but the data doesn’t show up when I make the ?opt_fields=custom_fields.display_value request.

There are two kinds of custom fields: At the portfolio level for projects, and at the project level for tasks.

Your initial post sounded like the former but now I understand it’s the latter. I updated the title of this thread to clarify.

You were looking at an object for the project but you’ll need to look at an object for each task, either Get a task or perhaps using Search tasks in a workspace.

In either case, you’ll see the same custom_fields array I mentioned in my other reply.

That should resolve your issue.

Thanks,

Larry

1 Like

Yep, both of those did the trick! Thanks!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.