We have released a small update to the CRM Migration Assistant which includes the following updates:

  1. Added 0 and 1 as supported Submit Options
  2. Fixed issues with converting .AddOption to .addOption method.
  3. Conversion alerts were added for the following JavaScript properties:
  • .title
  • .vAlign
  • .contentEditable
  • .innerText
  1. Any .style property that is not either display or visible is now marked as a conversion issue. This is to help identify instances where people have created unsupported code which will probably not work within the CRM 2011 environment.
  2. The use of document.all.mnuBar1 now produces a conversion alert.
  3. Instances of the DOM element 'Notifications' will cause a conversion alert will be generated. This is a special CRM form element at the top of each data entry form that shows alerts to the user. For more information on using this technique, see this article.

 

You may download the new package here.

Tagged with:  

CRM 2011 Cross-Browser Support Poll

On January 30, 2012, in CRM 2011, Dynamics CRM, by Mitch Milam

HI Everyone,

If you have not heard, Dynamics CRM 2011 will very shortly support browsers other than Internet Explorer.

I am absolutely unsure if this is a big deal for customers or not.  So, I thought I'd ask.

I've created a poll on my site that allows you to select which browsers you will be using. If you have some time, I'd appreciate the feedback.

You can also leave a comment on this post.

Thanks, Mitch

Tagged with:  

One of the most fascinating things I found during the creation of the CRM Migration Assistant is the different methods developers use to access CRM form fields, and other form elements.

Normally, people access a form field using the following style of JavaScript:

crmForm.all.name

This is the normal and perfectly acceptable (and supported) method for referencing CRM form fields.

But, for various reasons, I've also seen fields reference using these crmForm methods:

crmForm.name
crmForm.elements["name"]
crmForm.all["name"]
crmForm["name"]

This is perfectly acceptable JavaScript and the CRM 4.0 object model had no objection to this practice, so all of these methods seemed to work.

In fact, accessing CRM form fields using the JavaScript document object using these methods worked as well:

document.all("name_c")
document.all["name"]
document.getElementById("name_c")

The real question is: Will these methods continue to work when the organization is upgraded to CRM 2011?

The answer is: If you have used standard and supported methods within your JavaScript, then yes, the code will be supported.

This means referencing all of your form fields using the standard access model:

crmForm.all.name

Other options may or may not work correctly. Your experience my vary depending on which of the above methods were used.

Fortunately, the CRM Migration Assistant converts all of these "unsupported" form field access types into fully-supported CRM 2011 code using Xrm.Page.getAttribute and Xrm.Page.getControl, depending on how the field was being used.

If you haven't already, download the trial version of the CRM Migration Assistant and convert some of your questionable JavaScript through the conversion process.

If you run into any conversion issues, send me a code sample so that I can update the conversion process.

Tagged with:  

Debugging Sandboxed Plugins

On January 23, 2012, in CRM 2011, Development, Dynamics CRM, by Mitch Milam

I learned some interesting things about working with Sandboxed plugins last week that I thought I'd share.

Attaching to Processes

Sandboxed plugins are run by Microsoft.Crm.Sandbox.WorkerProcess.exe so that is the process that you will need to attach to in order to debug your plugin.  If there are more than one, then attach to all of them.

If there are none active in memory, perform whatever process that activates your plugin and the Sandbox HostService will activate at least one. Then you can attach to them.

If you are running a sandboxed plugin with an asynchronous step, you will also need to attach to CrmAsyncService.exe since this process is involved as well. More on that in a minute.

 

Using the Debugger

The Sandbox HostService only allows the WorkerProcess to process for 30 seconds. If it runs longer, it is terminated. This is a real problem when you're trying to look at data within the debugger and your code and data disappears in front of your eyes.

Add a DWORD key called SandboxDebugPlugins with a value of 1 to the MSCRM registry to prevent the process from being abnormally terminated.

 

Asynchronous Plugin Steps

A very interesting factoid is that if you have an asynchronous step inside of the sandbox plug, the processing of the step is different:

The CrmAsyncService.exe process will run your asynchronous step as it would any other async process but since it is from a sandboxed plugin, it will actually hand your plugin to the Sandbox process for execution.

This is why you must attach to both the Microsoft.Crm.Sandbox.WorkerProcess.exe and CrmAsyncService.exe in order to get the Visual Studio debugger to launch.

 

More Information

See this topic in the CRM SDK for more information.

Tagged with:  

As I was reviewing notes from the recently released CRM SDK 5.0.9, I noticed a section on Error Codes.  "This looks interesting," I thought.

After you have installed the CRM SDK, navigate to the following folder:

sdk\samplecode\cs\helpercode

In that folder you will find, among other things, three files related to error codes, each in a different format. It appears that there are around 2,015 error codes.  Wow, that's a lot of documentation!

crmerrors.xlsx

Is a Microsoft Excel worksheet formatted like this:

image

errorcodes.cs

Is a C# class that has the error codes inside of a class that you can incorporate into your applications. The code starts off like this:

private static Hashtable ErrorMessages = new Hashtable();

static ErrorCodes()
{
    ErrorMessages.Add(InvalidAuth,
        "Organization Authentication does not match the current discovery service Role.");
    ErrorMessages.Add(CannotUpdateOrgDBOrgSettingWhenOffline,
        "Organization Settings stored in Organization Database cannot be set when offline.");
    ErrorMessages.Add(InvalidOrgDBOrgSetting,
        "Invalid Organization Setting passed in. Please check the datatype and pass in an appropriate value.");
    ErrorMessages.Add(UnknownInvalidTransformationParameterGeneric,
        "One or more input transformation parameter values are invalid: {0}.");
    ErrorMessages.Add(InvalidTransformationParameterOutsideRangeGeneric,
        "One or more input transformation parameter values are outside the permissible range: {0}.");

crmerrors.xml

The final version of the file is an XML which is formatted like this:


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<crmerrors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <crmerror>
    <ErrorId>
      80048516
    </ErrorId>
    <ManagedErrorName>
      InvalidAuth
    </ManagedErrorName>
    <ErrorMessage>
      Organization Authentication does not match the current discovery service Role.
    </ErrorMessage>
  </crmerror>
  <crmerror>
    <ErrorId>
      80048515
    </ErrorId>
    <ManagedErrorName>
      CannotUpdateOrgDBOrgSettingWhenOffline
    </ManagedErrorName>
    <ErrorMessage>
      Organization Settings stored in Organization Database cannot be set when offline.
    </ErrorMessage>
  </crmerror>

Regardless of how you use it, these files are a great resource for any CRM developer.

Tagged with:  

CRM SDK 5.0.9 Released

On January 17, 2012, in CRM 2011, Customization, Dynamics CRM, by Mitch Milam

You may download it here.

This update includes:

New and updated topics

Description of changes

Microsoft_Dynamics_CRM_2011_SDK_Readme.htm

Updated the readme for this version of the SDK package.

SDK\Bin

Updated the assemblies for Microsoft Dynamics CRM 2011 Update Rollup 6 and the Microsoft Dynamics CRM Online January 2012 Service Update. For on-premises customers, updates and hotfixes can be installed automatically from Microsoft Update. You can also search for updates on the Microsoft Download Center. For online customers, update rollups will be deployed automatically to your organization.

SampleCode\CS\HelperCode\CrmErrors.xlsx

SampleCode\CS\HelperCode\CrmErrors.xml

SampleCode\CS\HelperCode\ErrorCodes.cs

Updated error code files for this release.

Tools\PluginRegistration

Added federation and online federation provider types for Microsoft Office 365 support. In addition, fixed an issue that had occurred when configuring ACS.

SampleCode\CS\*

SampleCode\VB\*

Updated all samples to use the GetOrganizationProxy helper method instead of instantiating OrganizationServiceProxy. This was done to add support for federated and managed Microsoft Office 365 organizations. For more information, see Active Directory and Claims-Based Authentication.

Client-Side Context Reference

Updated this topic and related topics to state that the Xrm.Page.context.getAuthenticationHeader function is deprecated and should not be used. Scripts upgraded from Microsoft Dynamics CRM 4.0 may continue to use the global getAuthenticationHeader function and should not be modified to use Xrm.Page.context.getAuthenticationHeader. New scripts using the REST endpoint for web resources or the SOAP endpoint for web resources do not require this function for authentication.

Create New Entity Forms

Updated this topic to provide information that the EntityMetadata.CanCreateForms property controls whether new forms can be created for an entity.

Create Solutions That Support Multiple Languages

Included information about creating localized dialogs processes.

Disaster Recovery in Microsoft Dynamics CRM Online

Added a topic about Microsoft Dynamics CRM Online disaster recovery.

   
   

Sample: Authenticate Users with Microsoft Dynamics CRM Web Services

SampleCode\CS\GeneralProgramming\
Authentication\AuthenticateWithNoHelp

SampleCode\VB\GeneralProgramming\
Authentication\AuthenticateWithNoHelp

Added new samples that authenticate the user with the web services without using the helper code.

Unsupported Customizations

Clarified that adding indexes is not supported for Microsoft Dynamics CRM Online.

Use JavaScript with Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online

Added a topic to help developers find information about using JavaScript with various features that support it.

Xrm.Page.ui.refreshRibbon

Removed reference in remarks to the refreshRibbon method that causes ribbon display rules to be re-evaluated. Only enable rules can be re-evaluated after the page loads.

Tagged with:  

If you are developing a plugin, sooner or later you will need to do something in a plugin that requires "listening" to more than just Create, Read, Update, and Delete messages.

What is a Message?

If you are new to Dynamics CRM development, a Message word that is used to instruct CRM to do something. As far as I can tell, since the early versions of the CRM SDK used the SOAP protocol exclusively, and SOAP passes messages, the term message became the standard name for CRM internal processing options

If anyone has any other explanation, please let me know and I'll update the post.

What do you do with Messages?

Messages are what a plugin "listens for" to know when to activate and perform whatever job it was programmed to do.

A Message is associated with a Plugin Step ( internally called a SdkMessageProcessingStep ), which is a pointer that associates your plugin code to a Dynamics CRM internal action.

Inside the Plugin Registration Tool, you may see something like this:

image

As you can see, I have an assembly called ClassLibrary1, within that assembly I have a single plugin, SamplePlugin, and that plugin has two steps:

  1. Create of a queueitem
  2. Create of an email

Create is the Message.

 

How do I make it GO?

So, how do you, as a plugin developer, figure out what message you need to use to properly configure your plugin?

Well, for the most part, it's pretty simple: You select the CRM operation you are interested in intercepting then select Entity that will be associated with that Message.

Here is how the configuration looks within the Plugin Registration Tool:

image

 

But what if I don't know what message to use?

Excellent question, and the reason for my article.

The very fine folks in the Dynamics CRM documentation team have created for us, an Excel worksheet that lists all of the messages associated with a CRM Entity.

After you install the CRM SDK, you'll find the worksheet here:

sdk\tools\message-entity support for plug-ins.xlsx

And here is how it looks:

image

It lists the following information:

  • Message Name
  • Primary Entity
  • Secondary Entity
  • Message Availability
    • Server or
    • Both – for Client and Server
  • Entity Supported Deployment
    • Server or
    • Both – for Client and Server

How do I use it?

Usually, I know what Entity I am going to work with so I start there and filter the Primary Entity based on that information.

Next, I try and locate the Message Name that I might need. Now this sounds simple, but in certain cases, it's really hard to determine what exact message you should connect with.

In that case, I will sometimes create steps that monitor each possible message, connect my debugger to IIS, then execute the CRM operation of interest so that I see what message is actually being passed through to my plugin.

You can find the message in the Execution Context's MessageName property.

 

Option 2

A second option is to look in the SDK help file itself for topics like:

Email (E-mail) Entity Messages and Methods

Where you will find information like this:

image

This should be the same (mostly) list of Messages found in the Excel file. Just remove the word "Request" from the end of the Message Name found in the SDK help file and you should have a match.

 

Conclusion

Well, that's about it for today. Hopefully this will help you in your plugin development efforts.

Tagged with:  

Getting Started with CRM Mobile Express

On January 4, 2012, in CRM 2011, Dynamics CRM, Mobile, by Mitch Milam

In case you didn't know, Dynamics CRM 2011 has a basic mobile web site built into the product. You access the mobile site by adding /m to your CRM URL, like this:

http://crm2011/contoso/m

Which will produce a web page that looks like this:

image

Here is what a view looks like:

image

and finally, record detail:

image

Now that we've seen it work, let's look at how to make it work.

Configuring the Mobile Experience

Configuring Dynamics CRM 2011 for mobile use is a multi-step process, which is as follows:

Step 1: Enable mobile support for the Entity

The first step is to actually enable mobile support at the Entity level, which you accomplish by checking the Mobile Express checkbox on the Entity's information page:

image

Click the Save button to record your changes.

Step 2: Update the Mobile form

Dynamics CRM 2011 includes a mobile form, as you can see from the Forms view:

image

Double-click the Mobile Information form to open it in the form editor.

image

If you are familiar with the normal CRM form editor you will notice that this is not it.  Actually, you really can't do much with the form besides select what fields will be displayed.

This is accomplished by adding or removing fields from the Selected Attributes list on the right side of the dialog.

Like other CRM forms, you can assign roles to the form to show this only to certain types of people, if you wish.

Step 3: Publish your changes

After you have finished editing the mobile form, publish the Entity and your changes will be available to users.

Conclusion

That is about it for Mobile Express. It provides basic HTML-level access to CRM data through just about any mobile device. 

However, should you need offline capabilities or a richer user experience, you might try a solution from a third-party vendor such as CWR Mobility, among others.

Tagged with:  

Ribbons and Entities

On December 26, 2011, in CRM 2011, Customization, Dynamics CRM, by Mitch Milam

When customizing the ribbon of an Entity, it is important to note that the ribbon is part of the Entity itself, not the Application Ribbon.

This means that if you are creating a solution, you only have to include the Entity component, not the Application Ribbon component.

Tagged with:  

Export JavaScript Utility Updated

On December 22, 2011, in CRM 2011, Customization, Dynamics CRM, by Mitch Milam

I've updated my Export JavaScript for CRM 2011 to fixe a small bug related to the naming conventions of web resources. This cause the JavaScript not to be exported.

You can download the update from the Free Utilities page:

http://blogs.infinite-x.net/free-utilities

See this post for more detail about the process.

Tagged with: