Error during solution import: Your organization does not allow this type of workflow.

Today I faced following error during solution import:

This workflow cannot be created, updated or published because it was created outside the Microsoft Dynamics CRM Web application. Your organization does not allow this type of workflow.


There is simple solution. You should enable XAML workflows as described here: http://msdn.microsoft.com/en-us/library/8da8c71e-84af-441e-b99b-0b59399f10f6#enable_disable

You can also get this error if you import solution from CRM server which has higher rollup installed then on the target server.

Unit testing CRM 2011 plugins. Approaches - Part 2

As promised I will explain two more approaches today.

I’m going to test same plugin as I tested in previous post. Plugin creates a task to qualify lead in two weeks each time lead is created. I use MS Test as unit testing framework.

Structure of the solution is explained in previous post. It much easy to get the thing right if you take a look on part 1: "Unit testing CRM 2011 plugins. Approaches - Part 1".

Unit testing CRM 2011 plugins. Approaches - Part 1

Today I want to describe two possible ways to unit test plugins. I will explain advantages and disadvantages of approaches.

I’m going to unit test a plugin which creates a task to call a lead in two weeks after lead creation. MS Test will be used as unit testing framework.

First of all let me give you overview of the Visual Studio solution. It consists of three projects:


HowTo.Logic – Class library. Contains business logic.
HowTo.SimplePlugin – Class library. Contains plugins.
HowTo.Tests – Test Project.

MS CRM 2011 Plugins FAQ

Following post contains frequently asked questions about plugins. You will find info about:
  • Isolation mode
  • Where secondary entity is used
  • Where to store plugin assemblies
  • Pre/Post Images, Target entity
  • How to access secure\unsecure configurations and what is the difference
  • Pipeline stages descriptions
  • e.t.c.

HOW TO: Create simple plugin in MS CRM 2011

Today I will describe how to create a simple plugin and register it in MS CRM 2011. Plugin will create a task each time user create new lead.
To do that I need: Visual Studio 2010 and .NET Framework 4.0 installed on my dev. machine, Microsoft CRM SDK.

1. Open Visual Studio and create new “Class Library” project.

2. Add new Reference

a. Press Add New Reference


b. Navigate to folder where you extracted Microsoft CRM SDK and select file
bin\microsoft.xrm.sdk.dll and press "Ok"


HOW TO: Change fileld requirement level, Bypass valiation in MS CRM 2011

MS CRM 2011 provides api to change requiremnt level of fields of the form (this is a new feature of crm 2011).

Xrm.Page.getAttribute("my_fieldname").setRequiredLevel("none");
Xrm.Page.getAttribute("my_fieldname").setRequiredLevel("required");
Xrm.Page.getAttribute("my_fieldname").setRequiredLevel("recommended");

If you need to bypass validation during saving of the form use function below. Call it during form load. Note! This script is not supported by Microsoft CRM SDK and it could couse errors. I used it on lead form without any trouble.

function BypassValidation()
{
$get("crmForm").BypassValidation = true;
}

HOW TO: Show/Hide notifications (warnings) in MS CRM 2011

This post describes:
  1. How to disable notifications on the form
  2. How to show custom notification (info, warning, error)
  3. How to clean notification area
All scripts below require jQuery.
Most frequently I use these scripts to get rid of warning “The following error occurred: Missing Price List” and show custom messages