locked
Error creating a new Entity - CRM 2011 RRS feed

  • Question

  • Hi hi!

    We have migrated an On-premise CRM 4.0 Organization to CRM 2011.

    In this moment we are getting an error when we try to create a new entity.

    the log file show this information:

     

    Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.Data.SqlClient.SqlException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #19716FBDDetail:
    <OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
      <ErrorCode>-2147220970</ErrorCode>
      <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
        <KeyValuePairOfstringanyType>
          <d2p1:key>CallStack</d2p1:key>
          <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
       at System.Data.SqlClient.SqlDataReader.get_MetaData()
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
       at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
       at Microsoft.Crm.CrmDbConnection.InternalExecuteWithRetry[TResult](Func`1 ExecuteMethod, IDbCommand command)
       at Microsoft.Crm.CrmDbConnection.InternalExecuteReader(IDbCommand command, Boolean capturePerfTrace)
       at Microsoft.Crm.CrmDbConnection.ExecuteReader(IDbCommand command, Boolean impersonate, Boolean capturePerfTrace)
       at Microsoft.Crm.BusinessEntities.BusinessProcessObject.ExecuteQuery(CrmDbConnection dbConnection, IDbCommand command, ISqlExecutionContext context)
       at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.CollectSecurityPrincipals(Guid roleId, ExecutionContext context)
       at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.CollectAndReInitPrincipals(Guid roleId, RolePrivilege[] privileges, ExecutionContext context)
       at Microsoft.Crm.ObjectModel.RoleServiceInternal`1.AddNewPrivilegesToExistingRole(Guid roleId, RolePrivilege[] privileges, ExecutionContext context)
       at Microsoft.Crm.Metadata.SecurityHelper.AddPrivilegesToUserRole(RolePrivilege[] privileges, Guid[] roleTemplates, ExecutionContext context)
       at Microsoft.Crm.Metadata.SecurityHelper.CreateEntityHelper(IEntityDescription entityDescription, OwnershipTypes ownershipTypeMask, ExecutionContext context)
       at Microsoft.Crm.Metadata.EntityService.CreateInternal(EntityCreateInfo entityInfo, ExecutionContext context)
       at Microsoft.Crm.Metadata.EntityService.Create(EntityCreateInfo entityInfo, ExecutionContext context)
       at Microsoft.Crm.Metadata.EntityService.Create(EntityCreateInfo entityInfo, Guid solutionId)
       at Microsoft.Crm.Application.WebServices.SystemCustomization.EntityCreate.Execute(Guid solutionId, ParameterBag paramBag)
       at Microsoft.Crm.Application.WebServices.SystemCustomization.SystemCustomization.CreateEntity(XmlNode data)</d2p1:value>
        </KeyValuePairOfstringanyType>
      </ErrorDetails>
      <Message>System.Data.SqlClient.SqlException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #19716FBD</Message>
      <Timestamp>2011-10-25T14:42:25.5775435Z</Timestamp>
      <InnerFault i:nil="true" />
      <TraceText i:nil="true" />
    </OrganizationServiceFault>

     

    I have read some threads where the error is referenced to a custom dll, but we have copied all the dll files.

    In the CRM 4.0, I found some custom dll into the "C:\Program Files\Microsoft CRM\CRMWeb\ISV" and some referenced files into the "C.\Program Files\Microsoft CRM\CRMWeb\_static\_common\scritps". we have copied all the custom dll and referenced files in the new CRM 2011, but we got the same error.

    Thanks for your help!


    Best Regards,

    Hernando.

    Tuesday, October 25, 2011 3:01 PM

Answers

  • Sorry to resurrect a dead thread, but I was having this same problem and managed to find the cause.

    It seems to be a problem in both CRM 4.0 and 2011, in that modifying the Primary Field of the new entity to one which will be automatically created when you save the new entity (even if it's what you want to use as a primary field, such as an ID) will throw a generic SQL error.

    It's a bit late coming for you, but hopefully it may help someone :)

    Tuesday, November 6, 2012 9:39 AM
  • Hmm.. That isn't a CRM error either.  I hate to say it but it might be time to open a ticket with Microsoft.  I don't think you should leave it at putting a stored procedure in the CRM database.  That is an unsupported and dangerous situation and you are jeopardizing your ability to take advantage of future upgrades potentially.   I would make a note of what you have done exactly to the original database and call Microsoft to have them help you through this. 
    Jamie Miley
    Check out my about.me profile!
    http://mileyja.blogspot.com
    Linked-In Profile
    Follow Me on Twitter!
    Wednesday, October 26, 2011 2:26 AM
    Moderator

All replies

  • Is this in data migration manager.  It looks like someone else got this exact error when importing an entity that contained an objecttypecode or OTC that was invalid.

    http://social.microsoft.com/Forums/eu/crm/thread/1d8d4024-b5e9-4a5b-a454-6d6210ba5c4f


    Jamie Miley
    Check out my about.me profile!
    http://mileyja.blogspot.com
    Linked-In Profile
    Follow Me on Twitter!
    Tuesday, October 25, 2011 6:18 PM
    Moderator
  • Hi Jamie!

    Thanks for your response.

    The new entity is been created as "New" in the customization window. It´s not been created through a csv file´s importation.

    Best Regards,

    Hernando.

    Tuesday, October 25, 2011 6:54 PM
  • If you haven't already, turn on tracing to see if the generated logs contain better information. 

    http://support.microsoft.com/kb/907490

    Otherwise I would say it's time to open a case with Microsoft unless anyone else chimes in.


    Jamie Miley
    Check out my about.me profile!
    http://mileyja.blogspot.com
    Linked-In Profile
    Follow Me on Twitter!
    Tuesday, October 25, 2011 6:59 PM
    Moderator
  • Hi Jamie!,

    Yes, I turned on the tracing and I got 17 log files. 13 are in this format "server-w3wp-CRMWeb-20111025-#.log".

    I found a lot of errors like:

     

    [2011-10-25 14:02:57.970] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   44 |Category: Platform.Sql |User: 00000000-0000-0000-0000-000000000000 |Level: Verbose | CrmDbConnection.InternalExecuteReader
        at CrmDbConnection.InternalExecuteReader(IDbCommand command, Boolean capturePerfTrace)
        at CrmDbConnection.ExecuteReader(IDbCommand command, Boolean impersonate, Boolean capturePerfTrace)
        at DBCommandExecutor.ExecuteQuery(IDbCommand command, ISqlExecutionContext context)
        at MetadataQueryLibrary.RetrieveMultiple(SimpleQueryExpression queryExpression, ISqlExecutionContext context, DatabaseQueryTarget queryTarget)
        at <>c__DisplayClass4.<RetrieveMultiple>b__3(SqlExecutionContext context)
        at OnDemandMetadataDataProviderBase.ExecuteInNewSqlContext(ExecuteInNewSqlContextHandler handler)
        at OnDemandMetadataDataProviderBase.RetrieveMultiple(SimpleQueryExpression queryExpression)
        at OnDemandEntityMetadataDataProvider.get_PrimaryKey()
        at EntityMetadata.get_PrimaryKey()
        at ReportDataProcessor.ProcessData(IList`1 rows, NameValueCollection parameters)
        at SolutionComponentsGridDataProvider.GetSolutionComponentsRows(String solutionId, Int32 componentType)
        at SolutionComponentsGridDataProvider.GetData(String[]& columnSet, Row[]& dataSet)
        at SysCustomizationGridDataProvider.LoadData()
        at GridUIProvider.PrepareGridData()
        at GridUIProvider.Render(HtmlTextWriter output)
        at DataGrid.RenderData(HtmlTextWriter output)
        at DataGrid.RenderInnerHtml(HtmlTextWriter output)
        at DataGrid.Render(HtmlTextWriter output)
        at Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
        at HtmlContainerControl.Render(HtmlTextWriter writer)
        at Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
        at HtmlTableRow.RenderChildren(HtmlTextWriter writer)
        at HtmlContainerControl.Render(HtmlTextWriter writer)
        at Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
        at HtmlTable.RenderChildren(HtmlTextWriter writer)
        at HtmlContainerControl.Render(HtmlTextWriter writer)
        at Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
        at HtmlContainerControl.Render(HtmlTextWriter writer)
        at Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
        at HtmlContainerControl.Render(HtmlTextWriter writer)
        at Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
        at HtmlTableRow.RenderChildren(HtmlTextWriter writer)
        at HtmlContainerControl.Render(HtmlTextWriter writer)
        at Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
        at HtmlTable.RenderChildren(HtmlTextWriter writer)
        at HtmlContainerControl.Render(HtmlTextWriter writer)
        at Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
        at HtmlContainerControl.Render(HtmlTextWriter writer)
        at AppAreaPage.Render(HtmlTextWriter output)
        at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
        at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
        at Page.ProcessRequest()
        at Page.ProcessRequest(HttpContext context)
        at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
        at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
        at ApplicationStepManager.ResumeSteps(Exception error)
        at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
        at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
        at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)
    >Query execution time: 0.0 seconds; database: ACRP_MSCRM; command: SELECT [AttributeId] AS [attributeid],
        [AttributeRowId] AS [attributerowid],
        [AttributeTypeId] AS [attributetypeid],
        [Name] AS [name],
        [PhysicalName] AS [physicalname],
        [TableColumnName] AS [tablecolumnname],
        [Length] AS [length],
        [IsNullable] AS [isnullable],
        [XmlAbbreviation] AS [xmlabbreviation],
        [EntityId] AS [entityid],
        [DefaultValue] AS [defaultvalue],
        [UpgradeDefaultValue] AS [upgradedefaultvalue],
        [ColumnNumber] AS [columnnumber],
        [ValidForUpdateAPI] AS [validforupdateapi],
        [LogicalName] AS [logicalname],
        [ValidForReadAPI] AS [validforreadapi],
        [ValidForCreateAPI] AS [validforcreateapi],
        [VisibleToPlatform] AS [visibletoplatform],
        [IsPKAttribute] AS [ispkattribute],
        [IsCustomField] AS [iscustomfield],
        [IsLogical] AS [islogical],
        [DisplayMask] AS [displaymask],
        [AttributeOf] AS [attributeof],
        [ValuesFromRelationshipAttribute] AS [valuesfromrelationshipattribute],
        [ReferencedEntityObjectTypeCode] AS [referencedentityobjecttypecode],
        [AggregateOf] AS [aggregateof],
        [IsSortAttribute] AS [issortattribute],
        [PrecisionValue] AS [precisionvalue],
        [PrecisionSource] AS [precisionsource],
        [IsIdentity] AS [isidentity],
        [IsReplicated] AS [isreplicated],
        [YomiOf] AS [yomiof],
        [HasMultipleLabels] AS [hasmultiplelabels],
        [IsRowGuidAttribute] AS [isrowguidattribute],
        [IsBaseCurrency] AS [isbasecurrency],
        [CalculationOf] AS [calculationof],
        [IsAuditEnabled] AS [isauditenabled],
        [OptionSetId] AS [optionsetid],
        [LinkedAttributeId] AS [linkedattributeid],
        [InheritsFrom] AS [inheritsfrom],
        [IsStoredOnPrimaryTable] AS [isstoredonprimarytable],
        [IsInheritanceTypeAttribute] AS [isinheritancetypeattribute],
        [IsUnmanagedAttribute] AS [isunmanagedattribute],
        [IsOneWayBooleanAttribute] AS [isonewaybooleanattribute],
        [CanBeSecuredForCreate] AS [canbesecuredforcreate],
        [CanBeSecuredForRead] AS [canbesecuredforread],
        [CanBeSecuredForUpdate] AS [canbesecuredforupdate],
        [IsSecured] AS [issecured],
        [ManagedPropertyLogicalName] AS [managedpropertylogicalname],
        [ManagedPropertyParentComponentType] AS [managedpropertyparentcomponenttype],
        [ManagedPropertyParentAttributeName] AS [managedpropertyparentattributename],
        [IsManaged] AS [ismanaged],
        [SolutionId] AS [solutionid],
        [OverwriteTime] AS [overwritetime],
        [SupportingSolutionId] AS [supportingsolutionid],
        [AppDefaultValue] AS [appdefaultvalue],
        [AttributeLogicalTypeId] AS [attributelogicaltypeid],
        [Locked] AS [locked],
        [AttributeImeModeId] AS [attributeimemodeid],
        [AttributeRequiredLevelId] AS [attributerequiredlevelid],
        [MaxLength] AS [maxlength],
        [MinValue] AS [minvalue],
        [MaxValue] AS [maxvalue],
        [Accuracy] AS [accuracy],
        [AccuracySource] AS [accuracysource],
        [LookupStyle] AS [lookupstyle],
        [LookupBrowse] AS [lookupbrowse],
        [ImeMode] AS [imemode],
        [DeprecatedVersion] AS [deprecatedversion],
        [IsCustomizable] AS [iscustomizable],
        [IsRenameable] AS [isrenameable],
        [CanModifySearchSettings] AS [canmodifysearchsettings],
        [CanModifyRequirementLevelSettings] AS [canmodifyrequirementlevelsettings],
        [CanModifyAdditionalSettings] AS [canmodifyadditionalsettings],
        [CanModifyAuditSettings] AS [canmodifyauditsettings] FROM [AttributeAsIfPublishedView] WHERE EntityId = 'fdc8b608-418c-4967-891f-333c5d137312' AND IsPKAttribute = 1.

     

    Best Regards,

    Hernando.

    Tuesday, October 25, 2011 7:24 PM
  • That doesn't look like a log error.  That is just an operation that is occurring.  I would do some more searching in the logs for the words error and exception.  The only place error occurs in this snippet is as a parameter to a function which doesn't really indicate an error.

     


    Jamie Miley
    Check out my about.me profile!
    http://mileyja.blogspot.com
    Linked-In Profile
    Follow Me on Twitter!
    Tuesday, October 25, 2011 7:34 PM
    Moderator
  • Hi Jamie!

    Thanks for your reply.

    I check the log files, but with your indications I don´t find any error. Then I ran a SQL Trace using the SQL Profiler and I found this exception:

    http://imageshack.us/photo/my-images/190/errorsp.jpg/

    To solve this problem, I looked for this Stored Procedure in another CRM DB and I created the script to create the SP in the actual DB. This was the solution to the error.

    Thanks for your help!

    Best Regards,

    Hernando.

    Tuesday, October 25, 2011 8:45 PM
  • Hmm.. That isn't a CRM error either.  I hate to say it but it might be time to open a ticket with Microsoft.  I don't think you should leave it at putting a stored procedure in the CRM database.  That is an unsupported and dangerous situation and you are jeopardizing your ability to take advantage of future upgrades potentially.   I would make a note of what you have done exactly to the original database and call Microsoft to have them help you through this. 
    Jamie Miley
    Check out my about.me profile!
    http://mileyja.blogspot.com
    Linked-In Profile
    Follow Me on Twitter!
    Wednesday, October 26, 2011 2:26 AM
    Moderator
  • Wednesday, July 11, 2012 6:33 PM
    Moderator
  • Sorry to resurrect a dead thread, but I was having this same problem and managed to find the cause.

    It seems to be a problem in both CRM 4.0 and 2011, in that modifying the Primary Field of the new entity to one which will be automatically created when you save the new entity (even if it's what you want to use as a primary field, such as an ID) will throw a generic SQL error.

    It's a bit late coming for you, but hopefully it may help someone :)

    Tuesday, November 6, 2012 9:39 AM