Our Asana infrastructure consists of a series of top level portfolios that can contain other portfolios and/or projects. In the UI view under these top level portfolios we have a few custom fields that track a avriety of metrics, but for this example, I am only concerned with the custom field ‘QTR’ which represents the fiscal quarter the work originated in.
The first API call that I used:
portfolio_details = client_wrapper.client.portfolios.get_portfolio('PORTFOLIO_GID_HERE')
This returned a payload that included custom_field_options with descriptive fields about the custom_field but not the values set (display_name) that I would see if I made the same call for a project.
I also attempted to include opt_include=‘custom_fields’ and that also did not return the custom_field object.
I also saw that there is a get_custom_field_settings_for_portfolio endpoint which the docs say should return the desired information. This time the object is actually called custom_fields but the display_name is not available so the value set cannot be obtained.
I also attempted to include the following two optional parameters, neither of which was successful in returning the display_name.
Ultimately I would like to be able to view the QTR custom_field.display_value for portfolios. First, that particular field isn’t even available in the custom_field_settings object that is returned in either the get_project or get_custom_field_settings_for_portfolio requests. Second, it appears that in both calls, the display_value is not returned, so even if QTR was available in this context, the display_value is not returned so I cannot capture the value set.
Is this information available for portfolios? Is there something I should change about my methodology to make that happen?
Hi @Nick_Whitesel and welcome to the forum!
I haven’t worked first-hand with custom fields at the portfolio level yet, but the actual custom field values for QTR are stored in each project at the project level. So I think if you do a
get_project for each project in that portfolio, the project data should include that project’s value for the QTR custom field.
Thanks for the reply! I think there might be a few holdups about this solution preventing it from being a viable solution.
First, you can nest (as we have done) portfolios inside of other portfolios with each having a different value set for QTR so there would be overlapping values with no clear way to choose a value for the parent portfolio. This value is set ath te portfolio level so it should be able to be captured at that level.
Second, you can set the value for QTR at the portfolio level without having any objects nested underneath. So if we were to engineer a solution that checked underlying projects and applied that value to the parent, there would be no way to do it in this scenario.
So since you can set this value at the portfolio level without any projects underneath, how does the UI save and return that value? Basically looking for to copy whatever method the Asana UI uses.
Can you post a screenshot illustrating this?
Of course - here you are. The first screenshot shows that the QTR value is set on each portfolio item and the second screenshot shows that Nick Test Portfolio B which has a QTR value of ‘Q2’ has no underlying portfolio items.
Here is an additional screenshot that makes it more clear that Q2 was set at the portfolio level.
Well, @Nick_Whitesel, you are correct AND you were verrrrrry close to figuring out the answer!
You are correct that portfolios can indeed have a
custom_fields property. It’s not docuemtned in the API docs - I’ll be reporting that to the Developer Relations folks who I’m sure will get that omission corrected - and you have to ask for it specifically in order to get it returned to you.
Which leads to your close call with the answer…
opt_fields=custom_fields , not
opt_include. Try that and you’ll see that it works.
This did the trick. Thank you so much for all of your help!