'display_name' Breaking When Empty

Hi!

I’ve been running the same code for months now, but today I got the classic “‘NoneType’ object is not iterable” error. The command line also printed out “‘display_value’”, and with some trial and error print statements, I’ve narrowed it down to that being the error. For reference, here is a code snipppet:

for fld in task[‘custom_fields’]:
dg[fld[‘name’]] = fld[‘display_value’]

This is inside a loop for all tasks, and some tasks have empty fields. Today, when I printed out fld, it no longer has display_value incldued:

{‘gid’: ‘1201130160371745’, ‘name’: ‘Level’}

When I looked at a sample task in the Asana API explorer, it looks like ‘display_name’ no longer shows up for custom fields that are left blank like it used to. Is anyone else seeing this issue and if so figured out a work around?

I have a try/except statement work around for now (coding in python), but it seems to be screwing up other parts of the code.

Thanks!

1 Like

The same issue happens to us since yesterday. Can someone revert the change back?

@AndrewWong @sasha_f maybe you can weigh in on this issue?

Hello! We’re also seeing the same issue, which broke one of our PRD jobs. We currently have some defensive code in place to allow it to start again but would be grateful for an update.

Hi, it seems they have changed the name of some fields in the API. I changed 'display_value' to 'name' for custom field ‘task type’ and 'display_value' to 'number_value' for custom fields with type ‘number’ and everything started working

@Dmitriy_Bakchinov,

What you describe may work, but to be clear, it’s not the case that they’ve changed any field names.

Every custom field set on a task has one of the following properties set, depending on its field type - these properties hold the actual value for that custom field on that task:

text_value
number_value
enum_value
mult_enum_value
people_value
date_value

So on a number type field, yes, you can expect that number_value will be present and will contain the value for that custom field on that task.

However, in addition to the above properties, there is also supposed to be a display_value property which holds a displayable representation of the value(s) for the custom field on the task.

As noted in this thread, it does seem to be missing, which looks to me like a bug. I’ve filed a report with Asana and will update this thread when I hear back.

1 Like

Hi @Clare_Specht, @Elena_Zhang, @Phil_Seeman, @Ehren_Dimitry, @Alex_Civita,

I’m really sorry for the disruption this caused! The issue is from a bug/inconsistency that we fixed in the API that had unintended consequences. We reverted the change 2 days ago and it just made its way to production so your code should work again.

Here is some more context on what happened:
In our API spec and developer documentation we state that the display_value property on a custom_field is a string. We ran a display type checker to confirm that the responses to requests match what is defined in our Open API Spec. The checker uncovered that an unselected custom_field in Asana was actually returning a display_value of null not a string.

We decided that the more logical behavior would be to not show a display_value field for custom_fields when there is no custom field value since doing so is actually showing custom property protos (on a particular project) rather than the values for that custom field on an individual resource/task.

We pushed what we thought was a fix – to not return a display_value for custom_fields that don’t have a value. Unfortunately, this turned out to be a breaking change for code that relied on that behavior.

We noticed a couple support tickets at the end of last week. We identified the cause on Monday morning and quickly reverted the code. The issue was exasperated by a delay in API code changes being pushed to production. Changes are normally pushed daily but the fix just hit production this evening.

Again, we apologize for causing this issue. Navigating breaking changes is challenging even when planned – unexpected ones are particularly frustrating. We have revised our internal guidelines to prevent similar issues from happening in the future.

Best,
Jeff

3 Likes

Hi Jeff,
My script is still returning an error: KeyError: 'display_value'
This began on Sep 29 (same time as others were facing issues). Could you please provide support or tell me how I can submit a ticket?
Thanks,
Thea

@Thea_Schiet I believe the change took longer than I was anticipating to go from beta to prod. I just tested fetching an unset custom field and it returned a display_value of null. Can you try your script again?

I also didn’t see it show up right after Jeff posted about the fix yesterday, but confirming what Jeff said just above, in my testing just now I can see it’s back!