Entity forms missing after upgrading to CRM2011 from CRM4: CRM2011 On-Premise

問題 Entity forms missing after upgrading to CRM2011 from CRM4: CRM2011 On-Premise

  • martedì 10 gennaio 2012 09:23
     
     

    I've just started tests for upgrading our CRM4 deployment to CRM2011.  Our CRM4 server is 32bit so I've setup the new server for CRM2011 and am using the attach database to a new SQL Server instance method for upgrading the database.

    During the upgrade everything appears to complete correctly, I don't get any warnings or errors in the log files and when I browse to the CRM2011 url it appears to be working correctly.

    However, some of our custom entities appear to be missing their forms.  When I try to open a record for one of these entities I get the following error message in the trace log:

    [2012-01-09 14:21:53.484] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   15 |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error | ExceptionConverter.ConvertMessageAndErrorCode
    >System.NullReferenceException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #2BCFA531: System.NullReferenceException: Object reference not set to an instance of an object.
    >   at Microsoft.Crm.Application.Forms.CustomizableForm.GetFormDescriptor(Int32 typeCode, FormType formType)
    >   at Microsoft.Crm.Application.Forms.CustomizableForm.Execute(Entity entity, FormType formType)
    >   at Microsoft.Crm.Application.Components.Utility.GenericEventProcessor.RaiseEvent(String eventName)
    >   at Microsoft.Crm.Application.Controls.PageManager.OnPreRender(EventArgs e)
    >   at System.Web.UI.Control.PreRenderRecursiveInternal()
    >   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

     

     

     

    If a try to create a new form for one of the entities I get this error message in the trace log:

    [2012-01-09 14:24:30.751] Process: w3wp |Organization:4cb95732-4938-e111-974a-00155d650a09 |Thread:   19 |Category: Application |User: 00000000-0000-0000-0000-000000000000 |Level: Error | ErrorInformation.LogError
    >MSCRM Error Report:
    --------------------------------------------------------------------------------------------------------
    Error: Exception of type 'System.Web.HttpUnhandledException' was thrown.

    Error Message: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Error Details: Exception of type 'System.Web.HttpUnhandledException' was thrown.

    Source File: Not available

    Line Number: Not available

    Request URL: http://localhost/GFSC2011/tools/formEditor/formeditor.aspx?action=0&appSolutionId=%7bFD140AAF-4DF4-11DD-BD17-0019B9312238%7d&formtype=main&objectTypeCode=10019&pagemode=iframe&sitemappath=Entities%7cSFA%7cnav_accts

    Stack Trace Info: [InvalidOperationException: Sequence contains no elements]
       at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
       at Microsoft.Crm.Utility.FormEditorUtility.GetFirstFormHavingLeastOrder(Int32 type, Int32 objectTypeCode)
       at Microsoft.Crm.Web.Tools.Views.FormEditorPage.GetFormXml(String formXmlString)
       at Microsoft.Crm.Web.Tools.Views.FormEditorPage.ConfigurePage()
       at Microsoft.Crm.Application.Controls.PageManager.OnPreRender(EventArgs e)
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    [HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown.]
       at System.Web.UI.Page.HandleError(Exception e)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
       at System.Web.UI.Page.ProcessRequest()
       at System.Web.UI.Page.ProcessRequest(HttpContext context)
       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


    [2012-01-09 14:24:30.751] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   19 |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error | ExceptionConverter.ConvertMessageAndErrorCode
    >System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #B3BD49D5: System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.InvalidOperationException: Sequence contains no elements
    >   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
    >   at Microsoft.Crm.Utility.FormEditorUtility.GetFirstFormHavingLeastOrder(Int32 type, Int32 objectTypeCode)
    >   at Microsoft.Crm.Web.Tools.Views.FormEditorPage.GetFormXml(String formXmlString)
    >   at Microsoft.Crm.Web.Tools.Views.FormEditorPage.ConfigurePage()
    >   at Microsoft.Crm.Application.Controls.PageManager.OnPreRender(EventArgs e)
    >   at System.Web.UI.Control.PreRenderRecursiveInternal()
    >   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    >   at System.Web.UI.Page.HandleError(Exception e)
    >   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    >   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    >   at System.Web.UI.Page.ProcessRequest()
    >   at System.Web.UI.Page.ProcessRequest(HttpContext context)
    >   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    >   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    [2012-01-09 14:24:30.751] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   19 |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error | ExceptionConverter.ConvertMessageAndErrorCode
    >System.InvalidOperationException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #6905D016: System.InvalidOperationException: Sequence contains no elements
    >   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
    >   at Microsoft.Crm.Utility.FormEditorUtility.GetFirstFormHavingLeastOrder(Int32 type, Int32 objectTypeCode)
    >   at Microsoft.Crm.Web.Tools.Views.FormEditorPage.GetFormXml(String formXmlString)
    >   at Microsoft.Crm.Web.Tools.Views.FormEditorPage.ConfigurePage()
    >   at Microsoft.Crm.Application.Controls.PageManager.OnPreRender(EventArgs e)
    >   at System.Web.UI.Control.PreRenderRecursiveInternal()
    >   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

     

    I have tried create an empty CRM4 organisation, copied some of the entities with missing forms to it and then upgraded that organisation to CRM2011 and that worked correctly with the forms appearing in CRM2011.  I can't find any commonality between the entities that have missing forms, such as workflows, plugins, etc.  In fact one of the entities is incredibly simple with only a couple of fields on a single tab and no JavaScript, workflow or plugins.  Other entities with lots of JavaScript, workflows and plugins are working correctly after the upgrade.

    I'm testing this in the latest version of CRM 2011 with Rollup 5.

    The only other information I've found online about missing forms has indicated that there were errors or warnings in the upgrade log file but as I mentioned above my upgrade log file only contains Info and Verbose messages.

Tutte le risposte

  • martedì 10 gennaio 2012 10:50
     
     
    On which Update Rollup version was your crm 4.0 org?
    Carsten Groth http://carstengroth.wordpress.com Microsoft Certified Technology Specialist
  • martedì 10 gennaio 2012 11:08
     
     
    The database I've been testing the upgrade with is currently patched to CRM Rollup 17, which I believe should be supported.  However, I'll try installing the latest rollup and report back.
  • martedì 10 gennaio 2012 11:54
     
     

    I´ve tested back to UR19 and it works with that


    Carsten Groth http://carstengroth.wordpress.com Microsoft Certified Technology Specialist
  • martedì 10 gennaio 2012 15:13
     
     

    If you setup a new web server & SQL Server for CRM 2011, I had a lot of luck doing the following:

    1. Install a Fresh Copy of CRM 2011 on the new server

    2. Setup an empty/default Org

    3. Backup & Restore CRM 4.0 Organization database to the new SQL Server

    4. Import the Restored Organization to CRM 2011 for the Upgrade

    I'm not saying this is necessarily a fix all for this, but in the past I've just experienced very good results upgrading this way when a new server is available for CRM, even with very complicated customizations. 

    Jeremy

  • mercoledì 11 gennaio 2012 10:59
     
     

    Hi Jeremy,

    Thanks for your reply.  The process you suggested is the one that I am following due to the fact that our CRM4 server is 32bit.

    Cheers,

    Adrian

  • mercoledì 11 gennaio 2012 15:08
     
     

    Adrian,

    I had I read the main line in your first post I would've realized that, sorry about that.  Are you applying Update Rollup 5 to the the CRM 2011 instance before importing the organization or are you just starting with the media install (no rollup) and then importing?

    Also, was this 4.0 environment at any point and upgrade from CRM 3.0?

    THanks,

    Jeremy

  • giovedì 12 gennaio 2012 19:33
     
     

    Hi Jeremy,

    I'm upgrading using the latest CRM 2011 installer, which should already got Rollup 5 applied - at least the version number matches the post Rollup 5 version number according to the Microsoft CRM Rollups information page.

    The organisation was created in CRM4 and NOT upgraded from CRM3.

    Cheers,

    Adrian

  • venerdì 13 gennaio 2012 10:15
     
     

    I have tried creating a blank CRM4 organisation (SANDBOX) and import just 4 custom entities from my main organisation (LIVE).  1 which had import correctly with the forms appearing in CRM2011 and 3 that had missing forms.

    I then followed the same upgrade procedure as I had done before: 1. copy SANDBOX_MSCRM database to new SQL server instance; 2. import SANDBOX into CRM2011.

    In this case the entity that had worked in the initial upgrade tests also worked in this test.  The other 3 entities still had missing forms but they were in the SystemForms table in the database but parented to the wrong entities.

    Finally, I tried creating another CRM4 organisation (SANDBOX2) and imported the 3 that had missing forms above.  I then followed the same upgrade procedure.  This time, the 3 entities had the forms correctly upgraded and attached in CRM2011.

    In each of these cases there have been no errors reported in the CRM 2011 upgrade log.  I have been over the CRM4 customisations xml with a fine tooth comb and cannot find any issues with it. The XML validates against the schema and all the ids appear to be present and correct. 

    Today I shall be applying CRM4 Rollup 20 to my development environment and re-testing the upgrade. I will report back if there are any new developments.

     

  • venerdì 13 gennaio 2012 16:34
     
     
    I have tried installing CRM4 Rollup 20 and manually installing CRM2011 Rollup 5.  The issue still exists so I have raised a support call with Microsoft to get it resolved.
  • venerdì 13 gennaio 2012 22:45
     
     

    AdrianRitchie,

     

    I would be interested in knowing how you resolved this issue.   Can you post once you have a solution?

     

    Regards, SK


    • Modificato stevenmk venerdì 13 gennaio 2012 22:46
    •  
  • martedì 24 gennaio 2012 15:52
     
      Contiene codice

    We're still testing to identify a complete solution (I'm running import at the moment) but one thing that was noticed is that some of the form tabs and sections had missing label descriptions.  These are required values when entered via the CRM4 Customisations UI.  Quite how they became empty is unknown as we have only ever used CRM4 and only with the based english language.

    I've fixed the missing labels in Visual Studio with the help of TTXPathNavigator (http://visualstudiogallery.msdn.microsoft.com/c5d4671c-2e29-4452-b039-6f931b7b1155) and the following XPath queries to find the missing labels:

    //tab/labels/label[@description=""]
    //section/labels/label[@description=""]
    

     

    I'll post another reply when I make further progress

  • martedì 24 gennaio 2012 17:42
     
      Contiene codice

    Fixing the missing section and tab labels didn't resolve the issue.

    However, I may have identified another cause, the entities that had missing forms after the upgrade also had duplicate section and tab ids in the CRM4 customizations.xml.  I identified these with the following XSLT and SQL and then fixed the problems with TTXPathNavigator in Visual Studio:

    XSLT:

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
    >
        <xsl:output method="text" />
    
        <xsl:template match="*" xml:space="preserve">
          truncate table sectionids
          truncate table tabids
          <xsl:apply-templates select="//section" />
          <xsl:apply-templates select="//tab" />
        </xsl:template>
    
      <xsl:template match="tab" xml:space="preserve">
        insert into tabids (id, entity, objecttypecode) values  ('<xsl:value-of select="@id"/>', '<xsl:value-of select="ancestor::entity/@name"/>', '<xsl:value-of select="ancestor::Entity/ObjectTypeCode"/>')</xsl:template>
      
      <xsl:template match="section" xml:space="preserve">
        insert into sectionids (id, entity, objecttypecode) values  ('<xsl:value-of select="@id"/>', '<xsl:value-of select="ancestor::entity/@name"/>', '<xsl:value-of select="ancestor::Entity/ObjectTypeCode"/>')</xsl:template>
    </xsl:stylesheet>
    

    SQL:

    SELECT xpath = '//section[@id="{'+LOWER([id])+'}"]/@id', COUNT(id) FROM sectionids group by id having COUNT(id) > 1
    union
    SELECT xpath = '//tab[@id="{'+LOWER([id])+'}"]/@id', COUNT(id) FROM tabids group by id having COUNT(id) > 1
    

    I'm running the import into CRM2011 at the moment and will post another update once that is complete.  I would have expected to have received error messages about this in the import log but I suspect the import wizard is catching exceptions and not always logging them.

  • martedì 24 gennaio 2012 19:11
     
     

    Testing the import having fixed the tab and section ids still didn't fix the issue.  However, using the same approach as above I have also found duplicate form ids.  I have fixed these and am re-running the import into CRM 2011.

    I was warned by Microsoft Support that editing the customizations.xml is not supported.  This contradicts this MSDN page which states that modifications to the FormXml areas of the customizations.xml file is supported: http://msdn.microsoft.com/en-us/library/cc906201.aspx

    My investigations indicate that in CRM4 the uniqueness of the ids in the XML is not varified but in CRM 2011 the storage of structure define in the CRM4 customizations.xml does require the ids to be unique.  Unforunately the import wizard does not appear to log these errors.

  • giovedì 26 gennaio 2012 23:43
     
     

    Directly editing the customizations.xml is not supported. Do you remember what other customizations you have made?   Did you add any form/field event handlers?

    Thanks,

    Mike

  • venerdì 27 gennaio 2012 07:15
     
     

    Hi Mike,

     

    The MSDN documentation states that the FormXml areas of the CRM4 customizations.xml can be modified directly in the Customizations.xml outside of the CRM UI. 


    I am awaiting confirmation from my support case engineer that what I have done will be supported.
    Kind regards,
    Adrian

     


    • Modificato AdrianRitchie venerdì 27 gennaio 2012 07:16 Fixed url
    •  
  • mercoledì 18 luglio 2012 07:00
     
     

    Hi Adrian

    Do you find the solution of the problem I am also facing the same issue after upgrading to CRM 2011

    Thanks,

    Safdar Shah

  • giovedì 19 luglio 2012 06:23
     
     

    Hi All,

    Anyone can have solution of this problem?

    Regards,

    Safdar Shah

  • venerdì 20 luglio 2012 09:28
     
     

    Hi Safdar,

    The problem in my case was due to duplicate Form, Tab and Section Ids in the CRM4 customisations.xml being duplicated across entities.  To resolve the problem I had to export the customisations from CRM4, change the Guids and re-import it into CRM4.  When I then performed the upgrade to CRM2011 the forms for the entities appeared.

    My post with the XSLT helps you find the duplicate Guids in the FormXML section but it's a manual process to replace them.

    Before anyone complains about that being not supported by Microsoft, I spoke to Microsoft Support about it and they said that my database would still be supported after the upgrade.

    Cheers,

    Adrian