Microsoft Dynamics CRM 2011 – Best Development Practices (Customization Best Practices)

This blog describes best practices for customizing Microsoft Dynamics CRM 2011. The following best practices will help in writing code and having customizations that perform better.

Using Custom Entities:

Save space on the server by renaming existing entities to make the entities more meaningful.

Customize an Entity rather than Creating a New One:

You should customize a system entity, such as the opportunity or the account entity, rather than replace it because there are many built-in features that you would have to recreate. For example, the opportunity and case entities have lookup fields to associate customers. Customers may be accounts or contacts. You cannot create a custom entity to have the same type of lookup. You can change the display name of a system entity to make it more meaningful to your business.

Technology to Extend Microsoft Dynamics CRM 2011:

As a developer who is interested in extending or customizing Microsoft Dynamics CRM, you have several methods of performing your tasks. In addition to adding client-side JavaScript code to a form, or adding custom ASP.NET pages, you can choose to write a plug-in or create a custom workflow by using the web interface that calls a custom workflow activity. But how do you decide when you should use a plug-in or when you should use a workflow? The technology that you choose depends on the task that you have to perform.

Single Long Workflow Or Multiple Child Workflows:

From a performance perspective, is it better to create a single long workflow or is it better to have multiple child workflows and call them in one parent workflow? The child workflow approach results in lower throughput, but it is more manageable if you need to change the workflow definition frequently. Compilation overhead is not a major concern because the workflow is compiled only during publishing. However, there is overhead for starting each workflow instance. This requires retrieving all entities used in the workflow as well as starting a child workflow in a 2-step process that includes a ‘Workflow Expansion Task’ and the actual workflow instance. For maximum throughput, use a single long workflow.

How to Mark Your Custom Workflow Activity As Completed:

The return value from the Execute method is used by Workflow runtime to mark the activity as “completed.” You should use return base.Execute(executionContext) unless the activity bypasses base class functionality. Avoid returning ActivityExecutionStatus.Closed.

How to Report Exceptions in Custom Workflow Activities:

You should throw an InvalidPlugInExecutionException. This error will be shown in the workflow instance form.

Define Custom Entities That Are Specific to Business Units:

Custom entities have privileges per security role but not per business unit. To define custom entities that are visible only to specified business units, you must create different security roles for each business unit, granting privileges to the custom entity in the appropriate role.

My above blog is based on and is a summary of Best Practices guidelines given by Microsoft.

I hope this blog about ‘Microsoft Dynamics CRM 2011 – Best Development Practices (Customization Best Practices)’ was informative. Please feel free to leave your comments.

Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: