I have this piece of code:
new QueryExpression
{
EntityName = "systemform",
ColumnSet = new ColumnSet("name"),
Criteria =
{
Conditions =
{
new ConditionExpression("objecttypecode", ConditionOperator.Equal, "account")
}
}
}
I can replace "account"
with the Entity's actual ObjectTypeCode
and both approaches work. Does CRM infer the ObjectTypeCode
via the logical name to make this possible?
Quote from MSDN
Always use the entity schema name (SchemaName) to refer to a custom entity in code and queries. Do not use the object type code (also referred to as entity type) code because tis integer value varies for custom entities in different organizations.
Going by the recommendation guidelines, yes, CRM does seem to resolve the objecttypecode
from the logical name and it almost suggests that the other way around (resolving obecttypecode from an integer value) might not always work for custom entities across different organizations.