Microsoft KB Archive/933451

= Error message when you click the lookup button next to the &quot;Great Plains Site&quot; field in the Order Product form in Microsoft Dynamics CRM 3.0 =

Article ID: 933451

Article Last Modified on 8/21/2007

-

APPLIES TO


 * Microsoft Dynamics CRM 3.0
 * Microsoft Dynamics CRM Connector for Microsoft Dynamics GP, when used with:
 * Microsoft Dynamics CRM 3.0

-



SYMPTOMS
Consider the following scenario in Microsoft Dynamics CRM 3.0:
 * You create a sales order.
 * Then, you create an order product for the sales order.
 * Finally, you click the lookup button next to the Great Plains Site field in the Order Product form.

In this scenario, you receive one of the following error messages.

If the DevErrors value is set to On in the Web.config file, you receive the following error message:

Server Error in '/' Application. The entity with ObjectTypeCode = 10001 was not found in the MetadataCache.

If the DevErrors value is set to Off in the Web.config file, you receive the following error message:

Query Builder Error No Entity.

This problem occurs if the following conditions are true:
 * The Microsoft Dynamics CRM Connector for Microsoft Dynamics GP is installed.
 * You create more than two custom entities before you install the Microsoft Dynamics CRM Connector.



CAUSE
This problem occurs because the Microsoft Dynamics CRM Connector for Microsoft Dynamics GP Setup program assumes that no custom entities exist in Microsoft Dynamics CRM.

The Setup program installs the New_BOOrderType custom entity and the New_BOProductSite custom entity. Then, the Setup program assigns ObjectTypeCode 10000 to the New_BOOrderType custom entity. The Setup program assigns ObjectTypeCode 10001 to the New_BOProductSite custom entity.

Microsoft Dynamics CRM uses ObjectTypeCode 10001 for the New_BOProductSite custom entity when you click the lookup button next to the Great Plains Site field. If you have created more than two custom entities before you install the Microsoft Dynamics CRM Connector, these ObjectTypeCode values may be incorrect.



WORKAROUND
For more information about this workaround, contact Microsoft Customer Support Services. For a complete list of Microsoft Customer Support Services telephone numbers, and for information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve the problem. The usual support costs will apply to additional support questions. The usual support costs will apply to issues that do not qualify for the specific update in question.

To work around this problem, change the ObjectTypeCode value for the New_BOProductSite custom entity to a correct ObjectTypeCode value.

Note Before you follow the instructions in this article, make sure that you have a complete backup copy of the database that you can restore if a problem occurs.

To do this, follow these steps:  Make sure that you have complete backup copies of the following databases:  The _MSCRM database The _METABASE database

For more information about how to back up the databases, view &quot;Chapter 26: Backing Up Your Microsoft CRM System&quot; in the Microsoft CRM 3.0 Implementation Guide. To obtain the Microsoft CRM 3.0 Implementation Guide, visit the following Microsoft Web site:

http://www.microsoft.com/downloads/details.aspx?FamilyID=1ff067f8-4f77-40f0-ae9c-68ada7d4f16a&DisplayLang=en

  Determine what ObjectTypeCode value is associated with the New_BOProductSite custom entity. To do this, run the following script against the _METABASE database.

Note Run this script by using SQL Query Analyzer or by using SQL Server Management Studio. USE _METABASE GO SELECT Name,PhysicalName,LogicalName, ObjectTypeCode FROM Entity WHERE ObjectTypeCode >= 10000 AND Name = 'New_BOProductSite' ORDER BY ObjectTypeCode Note In this script,  is a placeholder that represents the actual organization name.  If the ObjectTypeCode value for the New_BOProductSite custom entity is not equal to 10001, note the ObjectTypeCode value that is returned after you run the query.</li> Log on to the Microsoft Dynamics CRM 3.0 Web site as a user who has the Microsoft Dynamics CRM administrator role.</li> Click Settings, click Customizations, and then click Export Customizations.</li> Click Export All Customizations, and then save the file as the All_MSCRM_Customizations.xml file.

Note This step is used to back up all custom attributes and all custom entities.</li> Click an entity whose schema name is salesorderdetail.

Note By default, the Order Product entity has this schema name. However, the entity can be renamed.</li> On the More Actions menu, click Export Selected Customizations.</li> Click OK, and then save the file as the SalesOrderDetail_Original.xml file.</li> Make a copy of the SalesOrderDetail_Original.xml file, and then rename the copied file as SalesOrderDetail_Fixed.xml.</li> Use WordPad to open the SalesOrderDetail_Fixed.xml file.</li> In WordPad, click Replace on the Edit menu.</li> In the Replace dialog box, type 10001 in the Find what field, type the ObjectTypeCode value that you noted in step 3 in the Replace with field, and then click Replace All.</li> Save the SalesOrderDetail_Fixed.xml file.

Note Make sure that the file type is Text Document.</li> Click Settings, click Customizations, and then click Import Customizations.</li> Click Browse next to the Import File field, click the SalesOrderDetail_Fixed.xml file, and then click Open.</li> Click Upload. The Order Product entity appears in the Import Customizations form.</li> Click Import All Customizations.</li> After the Order Product entity customization is imported, click OK.</li> <li>Click Customization, and then click Customize Entities.</li> <li>On the More Actions menu, click Publish All Customizations.</li> <li>Click Start, click Run, type iisreset, and then click OK.</li> <li>Delete temporary Internet files. To do this, follow these steps: <ol style="list-style-type: lower-alpha;"> <li>Start Internet Explorer.</li> <li>Click Tools, and then click Internet Options.</li> <li>Use one of the following methods, depending on which version of Internet Explorer you are using: <ul> <li>In Windows Internet Explorer 7, click Delete in the Browsing history area, click Delete files in the Temporary Internet Files area, and then click Yes.</li> <li>In Microsoft Internet Explorer 6, click Delete Files in the Temporary Internet files area, and then click OK.</li></ul> </li></ol>

Note To correctly use the Great Plains Site field, you must create a Great Plains site, and you must associate the Great Plains site with the item that is integrated as the Microsoft Dynamics CRM 3.0 product.</li></ol>

<div class="status_section">

STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.

<div class="moreinformation_section">

Steps to reproduce the problem

 * 1) Create more than two custom entities.
 * 2) Install the Microsoft Dynamics CRM Connector.
 * 3) On the New menu, click Order.
 * 4) In the Name field, type an order name.
 * 5) Click the lookup button next to the Customer field, click a customer, and then click OK.
 * 6) Click the lookup button next to the Price List field, click a price list, and then click OK.
 * 7) Click Save.
 * 8) Click Existing Products, and then click New Order Product.
 * 9) Click the lookup button next to the Product field, click a product, and then click OK.
 * 10) Click the lookup button next to the Unit field, click a unit, and then click OK.
 * 11) Click the lookup button next to the Great Plains Site field.

The following code is part of an example of the SalesOrderDetail_Fixed.xml file. <ImportExportXml version=&quot;3.0.5300.0&quot;> <Entities> <Entity> <Name LocalizedName=&quot;Order Product&quot; OriginalName=&quot;Order Product&quot;>SalesOrderDetail</Name> <ObjectTypeCode>1089</ObjectTypeCode> <LocalizedName>Order Product</LocalizedName> <LocalizedCollectionName>Order Products</LocalizedCollectionName> … var aSiteLookups=window.document.forms['crmForm'].elements['productid'].DataValue; if(aSiteLookups && aSiteLookups.length > 0) {        if(IsOutlookLaptopClient) {               var lookupItem = openStdDlg(&quot;/_controls/lookup/lookupsingle.aspx?class=null&objecttypes=10005&browse=0&DefaultType=0&quot;,null,&quot;600px&quot;,&quot;488px&quot;,true,null,null); if(lookupItem && lookupItem.items.length > 0) {                       var lookupfield = crmForm.new_boproductsiteid.parentElement.parentElement.firstChild.firstChild; var lookup = event.srcElement; lookup.Clear; lookup.AddItems(lookupItem.items); }           }        else {               var productid = aSiteLookups[0].id; var url = '\\Integration\\LookupSite.aspx?productid='+productid+'&objecttypes=10005'; var lookupItem=window.showModalDialog(url); if(lookupItem && lookupItem.items.length > 0) {                       var lookupfield = crmForm.new_boproductsiteid.parentElement.parentElement.firstChild.firstChild; var lookup = event.srcElement; lookup.Clear; lookup.AddItems(lookupItem.items); //             BuildField(lookupfield, lookupItem); }           }    } …

<div class="references_section">