Setting portfolio custom field value through API

Hi there,

I’d like to know if there’s a way to set a custom field’s value on a portfolio through the API.
From what I saw in the doc, I can create a custom field … but not set it’s value and I find it a bit strange.

I was hoping I could do it with the function “.portfolios.update_portfolio” (I’m using the python client).

Thank you !

Hi @Thomas_Alibert and welcome to the forum,

Custom field values that display inside a portfolio don’t actually belong to the portfolio, they belong to the projects in that portfolio. So to update them, you want to use the project update endpoint instead of the portfolio update: Asana

Thanks for your reply Phil :slight_smile:

In my case I have a parent portfolio that contains inner portfolios.

The custom field has been set at the parent level and now I’d like to set the value for the inner portfolios but it seems I can’t do that.

Hi @Thomas_Alibert,

Oh interesting. I hadn’t come across this use case before (custom fields on a portfolio inside another portfolio), so I haven’t tried the following myself, but looking at the documentation, it looks like how you would do that is to set the custom field value (use the text_value, number_value, enum_value, or multi_enum_values, as appropriate for the custom field type) in the custom_field_settings object for the portfolio.

This is not explicitly documented in the API docs but it does say

image

I’m interpreting the highlighted part to mean that you use custom_field_settings to set the value in this case.

If you try it, please report back here and let us know if it works; if so, it really needs to be better documented…

I can’t make it work with the custom_field_settings property either.

For me that property only gives you details and meta-data about a given custom field but has nothing to do with setting the value.

The highlighted part just indicates that a parent on which a custom field has been configured allows the elements (tasks and projects, portfolios are not mentioned) it contains to get a value for this custom field.

Yeah, re-reading it again now, I think your interpretation is correct.

We need help on this from the Asana powers: @Kem_Ozbek @AndrewWong can you let us know about this? Is there a way to programmatically set the custom field value on a portfolio that’s contained within another portfolio?

1 Like