Hello Folks,
We have a unmanaged solution in our DEV environment. I've added few entities in that solution (Account,Contact,Lead,User and a custom entity ) . We have created patches of this solution and then cloned it with newer version.
Somehow, all the assets are added into solution for given entities but we need to deploy only specific components of it. Hence we are trying to remove it from solution and add it again with specific list of components.
But while removing (not deleting ) Lead,Contact or Account we are facing below error ,
User and custom entity is successfully removed from the solution.
Note : I'm not deleting entity , I'm just removing it from Un-managed solution
Below is the error details---
Unhandled exception:
Exception type: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]
Message: The object you tried to delete is associated with another object and cannot be deleted.Detail:
<OrganizationServiceFault xmlns:i="www.w3.org/.../XMLSchema-instance" xmlns="schemas.microsoft.com/.../Contracts">
<ActivityId>e386a93f-b72f-49d4-8c71-e6a72ce4f1a4</ActivityId>
<ErrorCode>-2147220953</ErrorCode>
<ErrorDetails xmlns:d2p1="schemas.datacontract.org/.../System.Collections.Generic">
<KeyValuePairOfstringanyType>
<d2p1:key>ApiExceptionSourceKey</d2p1:key>
<d2p1:value xmlns:d4p1="www.w3.org/.../XMLSchema" i:type="d4p1:string">Plugin/Microsoft.Crm.ObjectModel.SolutionComponentService</d2p1:value>
</KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType>
<d2p1:key>ApiOriginalExceptionKey</d2p1:key>
<d2p1:value xmlns:d4p1="www.w3.org/.../XMLSchema" i:type="d4p1:string">Microsoft.Crm.CrmException: The object you tried to delete is associated with another object and cannot be deleted. ---> Microsoft.Crm.CrmException: The object you tried to delete is associated with another object and cannot be deleted.
at Microsoft.Crm.BusinessEntities.CrmCascadeDBHandler.<>c__DisplayClass8_1.<CollectForCascadeWrapper>b__1(IDbCommand cmd)
at Microsoft.Crm.BusinessEntities.CrmCascadeDBHandler.<>c__DisplayClass12_0.<Collect>b__0()
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action, IEnumerable`1 additionalCustomProperties)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)
at Microsoft.Crm.BusinessEntities.CrmCascadeDBHandler.<>c__DisplayClass8_0.<CollectForCascadeWrapper>b__0()
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func, IEnumerable`1 additionalCustomProperties)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func)
at Microsoft.Crm.BusinessEntities.CrmCascadeDBHandler.CollectForDelete(IEnumerable`1 entityIds, Int32 entityOtc, ExecutionContext context, Boolean evaluateAsyncMode)
at Microsoft.Crm.BusinessEntities.CascadeEngine.<>c__DisplayClass9_0.<CascadeDeleteDB>b__0()
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action, IEnumerable`1 additionalCustomProperties)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)
at Microsoft.Crm.BusinessEntities.CascadeEngine.<>c__DisplayClass62_0.<Delete>b__0()
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func, IEnumerable`1 additionalCustomProperties)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func)
at Microsoft.Crm.BusinessEntities.BusinessProcessObject.<>c__DisplayClass203_0.<Delete>b__0()
at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action, IEnumerable`1 additionalCustomProperties)
at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)
at Microsoft.Crm.ObjectModel.SolutionComponentService.RemoveSolutionComponent(Guid componentId, Int32 componentType, String solutionUniqueName, ExecutionContext context, Boolean validateSolution)
at Microsoft.Crm.ObjectModel.SolutionComponentService.RemoveSolutionComponent(Guid componentId, Int32 componentType, String solutionUniqueName, ExecutionContext context)
--- End of inner exception stack trace ---
at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.Pipeline.<>c__DisplayClass2_1.<Execute>b__0()</d2p1:value>
</KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType>
<d2p1:key>ApiStepKey</d2p1:key>
<d2p1:value xmlns:d4p1="www.w3.org/.../XMLSchema" i:type="d4p1:string">0a59e1ba-3f13-11dd-9bde-0019b9312238</d2p1:value>
</KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType>
<d2p1:key>ApiDepthKey</d2p1:key>
<d2p1:value xmlns:d4p1="www.w3.org/.../XMLSchema" i:type="d4p1:string">1</d2p1:value>
</KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType>
<d2p1:key>ApiActivityIdKey</d2p1:key>
<d2p1:value xmlns:d4p1="www.w3.org/.../XMLSchema" i:type="d4p1:string">e386a93f-b72f-49d4-8c71-e6a72ce4f1a4</d2p1:value>
</KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType>
<d2p1:key>ApiPluginSolutionNameKey</d2p1:key>
<d2p1:value xmlns:d4p1="www.w3.org/.../XMLSchema" i:type="d4p1:string">System</d2p1:value>
</KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType>
<d2p1:key>ApiStepSolutionNameKey</d2p1:key>
<d2p1:value xmlns:d4p1="www.w3.org/.../XMLSchema" i:type="d4p1:string">System</d2p1:value>
</KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType>
<d2p1:key>0</d2p1:key>
<d2p1:value xmlns:d4p1="www.w3.org/.../XMLSchema" i:type="d4p1:string">Deleting records from SolutionComponent (ObjectTypeCode: 7103)
for Id(s) : d0374273-e32a-e911-a980-000d3ab9aac9
Exception : Cascade Delete failed due to cascade restrict relation. Details below :
Restricting entity SolutionComponent (ObjectTypeCode: 7103) has 2 referencing record(s).
</d2p1:value>
</KeyValuePairOfstringanyType>
</ErrorDetails>
<Message>The object you tried to delete is associated with another object and cannot be deleted.</Message>
<Timestamp>2019-06-20T13:15:00.8999236Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource i:nil="true" />
<InnerFault i:nil="true" />
<OriginalException i:nil="true" />
<TraceText i:nil="true" />
</OrganizationServiceFault>