0
votes

I am working on $metadata of Dynamics CRM and parsing EntityType for the specific entity.
I would like to know: Why attribute ContainsTarget has "false" value for all NavigationProperty. (considering false value as attribute is missing) ?

Attaching the snippet for account entity where NavigationProperty doesn't have ContainsTarget attribute. This is the case with all EntityType.

<EntityType Name="account" BaseType="mscrm.crmbaseentity">

<Property></property>
.
.

<Property></property>

<NavigationProperty Name="primarycontactid" Type="mscrm.contact" Nullable="false" Partner="account_primary_contact"> </NavigationProperty>
<NavigationProperty Name="Account_SocialActivities" Type="Collection(mscrm.socialactivity)" Partner="regardingobjectid_account_socialactivity"> </NavigationProperty>

</EntityType>

Thanks

1

1 Answers

1
votes

ContainsTarget property type indicates if related records can be navigated to using the navigation property O-Data URL.

In your case O-Data is telling you you cannot navigate to "primarycontactid" or "Account_SocialActivities" because no further property type information was returned.

For e.g. consider the following metadata returned by CRM

<EntityType Name="BooleanAttributeMetadata" BaseType="mscrm.AttributeMetadata">
<Property Name="DefaultValue" Type="Edm.Boolean"/>
<Property Name="FormulaDefinition" Type="Edm.String" Unicode="false"/>
<Property Name="SourceTypeMask" Type="Edm.Int32"/>
<NavigationProperty Name="OptionSet" Type="mscrm.BooleanOptionSetMetadata" Nullable="false" ContainsTarget="true"/>
<NavigationProperty Name="GlobalOptionSet" Type="mscrm.BooleanOptionSetMetadata" Nullable="false"/>
</EntityType>

The above metadata navigation property of "OptionSet" is an indication you can further navigate to the boolean option set metadata properties.