function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Petr SvestkaPetr Svestka 

sObjectType not filterable on ObjectTerritory2Association

Hi there,

A query:
select id, sobjecttype from objectterritory2association
returns records that have sObjectType of 'Account'.

But when I try to filter by it, it doesn't return any row:
select id, sobjecttype from objectterritory2association where sobjecttype = 'Account'
According to documentation, only the value 'Account' is suported, but why this can't be filtered?
https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_objectterritory2association.htm?search_text=objectterritory2association says it should be filterable.

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_erd_territory2.htm doesn't even list the file sObjectType.
A possible flaw in the documentation maybe?

Anyway, this seems to work though:
select id, sobjecttype, object.type from objectterritory2association where object.type = 'Account'

Can someone from the support explain the behavior?

Thank you
Petr Svestka
JAY_PJAY_P
Hey Svestka,
Please check ur custom object api name and field name which one is given in that object and make sure that u have any record for that query related ....
Thank You
Jay Parikh
email::jay29.salesforce@gmail.com
Mike OlexiukMike Olexiuk
I was stuck on the same thing.   Thanks!!!!