Thursday, June 27, 2013

The Timeline component for Microsoft Dynamics 2011

The company xRM Consultancy has developed a free component that can display activities in the timeline, and it can give a good overview of the Customer (Company or Contacts) or Opportunity activities.


I have noted the following advantages and disadvantages with this component:

Wednesday, June 19, 2013

Lazy fix of Infinite Loops in Plugins

Got an error stating that CRM has identified an infinite loop?

This usually means that the number of iterations reaches a maximum of 8. We can fix this by adding a depth check at the beginning of our plugin code, just after we initialize each of the service objects:

IPluginExecutionContext _context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
IOrganizationServiceFactory _factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
_sdk = _factory.CreateOrganizationService(context.UserId);
ITracingService _tracer = (ITracingService)serviceProvider.GetService(typeof(ITracingService));

if (_context.Depth > 1) // if the plugin has run more than once
{
        // if so, executes a return statement to cancel out of the plugin
        return;
}

Now when we run the plugin, we shouldn’t run into an infinite loop.

NB: You must be careful when using the DEPTH property as there can be more complex scenarios that you may run into. 

CRM 2011 Database Backup

How to easily automate CRM database backup?
You can do it with help of SQL command or own console app.
You’ll need to backup the following CRM databases:

  • MSCRM_CONFIG
  • *_MSCRM

SQL command to backup a database is:

backup database <database name> to disk ='C:\Temp\backups\sql\<database name_timestamp>.bak'
      with format, name ='Full backup of <database name>'

To backup the database using a console program - use the code below:

using (SqlConnection conn = new SqlConnection(this.ConnectionString))
{
    string path = Path.Combine("C:\Temp\backups\sql\", string.Format("{0}_{1:yyyyMMdd_HHmmss}.bak",this.DatabaseName, DateTime.Now));

    SqlCommand cmd = new SqlCommand(
        string.Format(@"backup database {0} to disk ='{1}' with format, name ='Full backup of {0}'",
            this.DatabaseName, path), conn);

    cmd.CommandTimeout = 120;
    conn.Open();
    cmd.ExecuteNonQuery();
    conn.Close();
}
Done ;)

Tuesday, June 18, 2013

What’s not supported in the next major release of Microsoft Dynamics CRM (2013?)

Removal of the 2007 Endpoint and Legacy Features

The 2007 service endpoint was deprecated in the Microsoft Dynamics CRM 2011 release. Extensions that use the 2007 endpoint will not be supported and will not work in the next major release of Microsoft Dynamics CRM. Note the following more detailed information:

  • Microsoft Dynamics CRM Online customers using the Microsoft account identity provider can continue to use extensions that require the 2007 endpoint after upgrade. However, prior to the transition of your organization to Microsoft online services (MOS), you will need to upgrade or remove those extensions that require the 2007 endpoint.
  • Microsoft Dynamics CRM Online customers using the Microsoft online services (MOS) identity provider will see no change in service. The 2007 endpoint has not been supported in organizations using the MOS identity provider.
  • When Microsoft Dynamics CRM 2011 on-premises and IFD customers try to upgrade their server to the next major release of Microsoft Dynamics CRM, the upgrade process will detect extensions that are using the 2007 endpoint or legacy Microsoft Dynamics CRM 4.0 features. If any of these extensions are found, the Environmental Diagnostic Wizard will report an error and you will not be able to continue the upgrade until those extensions are removed or upgraded to use the 2011 endpoint.

The following legacy Microsoft Dynamics CRM 4.0 features will be removed or will no longer be supported in the next major product release: