Friday, January 28, 2011

Fool Proof Data Imports in CRM

Sometimes it can be a challenge to get the data maps to work properly, but using the “Automatic” map is almost foolproof.  Follow these basic steps:

1.       Create an advanced find with all of the entity’s “custom columns” (ignore CRM columns like created by, status, etc)

2.       Export the results to Excel and remove the hidden GUID column (Column A)

3.       Using the exported data as a guide for picklist values, insert the new data

4.       Run the Import wizard.  You should see “Automatic” in the Data Map

Thursday, January 20, 2011

CRM 4.0 Required TCP Ports

I was trying to install CRM on a Server 2003 connecting to SQL 2008 and ran into this error:

The warning message:
|Warning| Check SqlServerAgentValidator : Warning: Setup was unable to verify that SQL Server Agent (SqlAgent$crm) was running.

The error message:
|  Error| Check CrmSqlDomainValidator : Failure: The SQL Server ‘{0}’ is unavailable.

Windows Server 2003 requires TCP/UDP port 445 to be open between CRM and the Database.  Once the firewall was opened, the installation went off without a hitch.  In my experience with Server 2008, this port was not required.  Microsoft has a comprehensive port list, but my list is below:

 

Ports I request for CRM on Server 2008 installs:

TCP 1433

TCP 135

 

Ports I request [now] for CRM on Server 2003 installs:

TCP 1433

TCP 135

TCP/UDP 445

Using CRM's TargetRetrieveDynamic to retrieve a DynamicEntity via Guid

This is a snippet from the SDK example: <sdk loction>\sdk\server\reference\cs\crmservice\dynamicentityretrieve.cs

 

            // Create the retrieve target.

            TargetRetrieveDynamic targetRetrieve = new TargetRetrieveDynamic();

 

            // Set the properties of the target.

            targetRetrieve.EntityName = EntityName.contact.ToString();

            targetRetrieve.EntityId = created.id;

 

            // Create the request object.

            RetrieveRequest retrieve = new RetrieveRequest();

 

            // Set the properties of the request object.

            retrieve.Target = targetRetrieve;

            retrieve.ColumnSet = new AllColumns();

 

            // Indicate that the BusinessEntity should be retrieved as a DynamicEntity.

            retrieve.ReturnDynamicEntities = true;

 

            // Execute the request.

            RetrieveResponse retrieved = (RetrieveResponse)service.Execute(retrieve);

 

           // Extract the DynamicEntity from the request.

            DynamicEntity entity = (DynamicEntity)retrieved.BusinessEntity;

 

Saturday, January 15, 2011

Troubleshooting CRM SSRS Errors

I had a perfectly happy production CRM environment humming along nicely…until I tried to install a second CRM instance that used the same SSRS server.  After the install (and rebooting the SSRS server), my production reports stopped working and the new CRM’s reports we’re not working either. 

I went through an episode of this w/ MS Premier Support during the first CRM install and I remembered some of the troubleshooting steps we took back then. 

 

The first thing I tried was to enable remote errors in SSRS.  That only helped a little because CRM still displayed the friendly error page, “Report cannot be displayed”.  To have CRM give me the detailed error message I had to set the DevErrors key to “true” in the CRM Web.Config and now I can see the error.  After adding the SSRS service account to my new CRM’s AD Group PrivReportingGroup and restarting the SSRS service, my “new” CRM reports started working, but the old ones were still broken.  Opening Regedit on the SSRS server to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM I can see my configdb key is pointing to the wrong server (this is what the CRM Data Connecor uses).  When I changed that key back to my production database instance (similar to the procedure for moving a CRM database) and rebooting my SSRS server, the reports worked again.

 

Summary:

Step One – Enable Remote Errors on SSRS

Step Two – Change CRM Web.Config DevErrors key to “On”

Step Three – Check the Active Directory groups (Start  -- Run -- DSA.MSC )

Step Four – Check Registry Keys

 

Microsoft support confirmed my predicament.  To do what I want (two CRMs on one SSRS server) I need to install a second SSRS instance.

Friday, January 7, 2011

Setting the Primary Key of a Custom Entity in a Plugin

I needed to set the primary key Guid on a custom entity in the Pre stage of a Plugin.  It required adding a KeyProperty to my DynamicEntity.

 

    Guid requestId = Guid.NewGuid();

    Key newReqKey = new Key(requestId);

 

    entity.Properties.Add(new KeyProperty("new_myentityid", newReqKey));

 

Troubleshooting CRM Entity Publish Errors

Here are a few things to keep in mind when working w/ entities in CRM

1.       When you export your entities, make sure you export all N:1 related entities.  When you select an entity and click export, there is a warning dialogue that reminds you of this, but nobody reads it.

2.       Make sure you have Published your entities after importing them.  I had an entity that was “broken”, but I couldn’t delete it until I had published it.  Running a query like this will help you determine if your entity has been published: SELECT * FROM OrganizationUIBase  WHERE ObjectTypeCode = <offending entity code>.

3.       Finally, if you cannot delete a published entity, Compare the fields in the Form with the entity attributes.  Microsoft Support gave me a tool to run a FormXML comparison.  Two times now there has been an attribute in the form was missing from the entity. Once you add the attribute back (type doesn’t matter), you can delete the entity and start fresh.