Get "name" field for entity

Hello! I know the “name” field can be different for every entity (eg. “code” for Shot, “content” for Task etc.) I also know if we query a multi-entity field, we get the result with (type, id, name) of the entity. So it feels like the mapping of which field is a “name” for each entity must exist in SG somewhere. Is there a way to access it or a way to query the name field of an entity?
I had a look at the schema_read functions, but nothing popped out at me.


Surprised there’s no response to this yet - in general, SG has moved mostly to ‘code’ as the field name for what we would call ‘name’, but they weren’t always so consistent.

That said, I don’t think SG themselves provides the info you seek - if you’re using the same function to query multiple entity types, I would make a dictionary a la {TYPE:FIELD_NAME} (eg {“Shot”:“code”} and query from that.

Thanks so much for responding! Yes, the custom dict approach is the one I am using right now.

The reason I brought it up in the forums is because the multi-entity queries returning a key “name” irrespective of the actual field name makes me sure that SG has it somewhere internally, and if they could expose it in API somehow, I’d rather use that as a more reliable source than me maintaining whatever and updating it whenever a new entity becomes relevant to my tools.

1 Like