Why do I see different records when querying the UserTerritory object?
|Knowledge Article Number||000213608|
|Description||When viewing the users of a Territory in the Salesforce UI only few users are seen. However, when querying the UserTerritory object for development, many more users are seen in the Territory.|
|Resolution||***Please be aware that this only applies to Territory Management 1.0***
The Salesforce UI only displays the user row entries which have an "IsActive" field entry of "true". When querying the UserTerritory object directly, results for rows with both "true" and "false" values for the "IsActive" field are returned.
The resolution is to include a constraint for "where IsActive = true" in the query.
See related: Object Reference for Salesforce and Force.com:UserTerritory