I am trying to access the values of custom fields in a portfolio. The program works for finding the custom field values from a project, but not for a portfolio. How can I fix this?
Hi @anon29930175,
You didn’t say what you’ve tried thus far, but “portfolio custom fields” aren’t stored on the portfolio, they’re stored in a project. If you get a project’s data from this endpoint, it will include the custom fields and their values.
Hi @Phil_Seeman,
Sorry I should’ve given more background. I’m writing a program in Visual Basic for Excel. The program is supposed to pull custom field values associated with the projects in a portfolio. I was able to figure out how to get the custom field data from projects and how to do this in a portfolio. However, in this portfolio, there are both portfolios and projects stored inside of it. So, how would I be able to get the custom field data from the portfolio stored inside of another portfolio?
Any feedback from the Asana API team would be much appreciated! If portfolios within portfolios is a new feature, maybe they don’t have an endpoint yet for portfolio custom fields?
It also appears that the native Asana export tools (CSV export and google sheet export) don’t include the portfolios stored within another portfolio
Hi @anon29930175 and @Logan_Nissenson,
Maybe I’m missing something here, but again, as far as I understand it custom fields aren’t stored in a portfolio, they’re stored in the project that appear in that portfolio. Whether the portfolio is contained within another one or not shouldn’t matter, as you’re using the projects
endpoint on a project within the portfolio to get the custom fields and values.
Hi @Phil_Seeman,
Thanks for the responses I appreciate the help. I’ve attached an example so we can all get on the same page. As you can see, there is a portfolio within a portfolio that has custom field values associated with it. When I use the /portfolios/{portfolio number} endpoint, the response contains the custom field settings, but not the custom field values. This is difficult because the portfolio does have custom field values, but I’m not sure how to access these values.
Ah, I see your point - for some reason, while projects
return their custom_fields
property by default, portfolios
do not.
To get the custom fields and values for your portfolio, include opt_fields=custom_fields
in your request. That should do the trick.
@Ross_Grambo @Andrew-asana, any idea why this inconsistency in the API? It seems to me that GET /projects/:project_gid
and GET /portfolios/:portfolio_gid
should behave consisntly with each other in terms of returning the custom fields collection, no?
Hi,
Sorry for my late question on this thread. It seems, that the opt_fields for retrieving the custom fields in a portfolio is archived? When using this API: Get portfolio items. My issue is the same as Anon described years ago, however I am working inside Zapier to connect two systems, what I would need is the ouput in the custom fields for a specific project inside the portfolio.
Any help or suggestion to do so would be great.
Thanks in advance.
What do you mean by “is archived”?
Hi Phil,
It seems, whatever opt_fields I include in the GET call, nothing seems to change, and it does not include the custom fields showcased inside the portfolio.
I use this one: https://app.asana.com/api/1.0/portfolios/XX/items?opt_fields=custom_field_settings.custom_field
It only outputs:
- GID of Project
- Name of Project
- Resource type
I might be missing other things, as I am not the most IT-friendly, however I need to learn it :).
Try the syntax shown above: opt_fields=custom_fields
custom_field_settings
does not contain the actual values of the custom fields; that contains the definition of which custom fields are in the project or portfolio, which won’t be of any value to you here.
Hi Phil, Thank you for the reply.
I see it works when trying it on the Asana guide page, however only GID of Project, Name of Project and Resource Type is included whenever I try do the API call inside Zapier.
Any idea or solution would be great, thank you in advance.
If it works properly in the Asana API page but not in Zapier, then it must be something specific to Zapier which you’d have to address with them, I’m afraid.