Tuesday, October 9, 2012

The Related Entity has already been configured with a parental relationship or a relationship behaviors cascade in MS CRM 2011

while i was creating relationship i got the below error...
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Entity: mccy_charitystatusapplication is parented to Entity with id: f01e8baa-c7f5-4ec3-b538-5a3eed8527f6. Cannot create another parental relation with Entity: ContactDetail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
  <ErrorCode>-2147192825</ErrorCode>
  <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
  <Message>Entity: mccy_charitystatusapplication is parented to Entity with id: f01e8baa-c7f5-4ec3-b538-5a3eed8527f6. Cannot create another parental relation with Entity: Contact</Message>
  <Timestamp>2012-10-10T03:23:52.7124266Z</Timestamp>
  <InnerFault i:nil="true" />
  <TraceText i:nil="true" />
</OrganizationServiceFault>

 
What was d misatke is, i ahve already cerated one "Parental" relationship with one more entity..
so as per the message its very clear that we can only create one "Parental" relationship for one entity.
(but we can have each one for 1:N and N:1). (this also follows the nature as one kid can have only one parent :P).
 
below is the details for Parental Relationships...
Parental Entity Relationships
Each pair of entities that are eligible to have a 1:N relationship can have multiple 1:N relationships between them. Yet only one of those relationships can be considered a parental entity relationship.
A parental entity relationship is any 1:N entity relationship where one of the cascading options in the Parental column of the following table is true.
Action
Parental
Not Parental
Delete
Cascade
RemoveLink
Restrict
Share
Cascade
UserOwned
Active
NoCascade
Unshare
Cascade
UserOwned
Active
NoCascade
Assign
Cascade
UserOwned
Active
NoCascade
Reparent
Cascade
UserOwned
Active
NoCascade
Each referencing entity in a 1:N entity relationship has one referencing attribute where the relationship can be considered parental.
For example, if you create a new custom entity and add a 1:N entity relationship with the account entity where your custom entity is the referencing entity, you can configure the actions for that entity relationship to use the options in the Parental column. If you later add another 1:N entity relationship with your custom entity as the referencing entity you can only configure the actions to use the options in the Not Parental column.
Usually this means that for each entity pair there is only one parental relationship. There are some cases where the referencing attribute on the referencing may include a reference to more than one type of entity.
For example, the Opportunity entity has a referencing attribute called customerid where a reference to either a contact or account record may be stored. There are two separate parental 1:N entity relationships in this case.
Any activity entity, for example, a task, fax, phone call, and so on, has a similar set of parental entity relationships for entities that can be associated using the regardingobjectid referencing attribute.
 
Regards,
Sudhanshu 
 

No comments:

Post a Comment