This week I learned, again, the importance of including the SiteMap in a custom solution.

If you do not add the SiteMap to your solution, and you've specified that custom entities be displayed within it, then CRM will not be instructed to modify the SiteMap to when the Solution is imported and your custom entity will not be displayed as you expect.

Tagged with:  

You can customize the CRM 2011 Ribbon to add additional functionality via buttons, for example.

When you add such a button, you use Web Resources to identify things such as icons and JavaScript functions, like this:

$webresource:new_CloneRecord.js

$webresource:new_CloneRecord32x32

It important to remember that any Web Resources referenced by the Ribbon exist ( added to CRM and published ) before you import your customized Ribbon XML.

If not, then you'll receive an exception and the import will fail.

The exception will probably look something like this:

Exception: FaultException`1
Message: The ribbon item 'MitchMilam.Form.account.MainTab.Save.CloneRecord' is dependent on Web resource id='new_CloneRecord32x322'.
StackTrace:
Server stack trace:
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.Xrm.Sdk.IOrganizationService.Execute(OrganizationRequest request)
   at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.ExecuteCore(OrganizationRequest request)
   at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.Execute(OrganizationRequest request)
   at VisualRibbonEditor.ServiceWrapper.ExecuteAsync(OrganizationRequest request, Action`1 callback)
   at VisualRibbonEditor.Solution.<>c__DisplayClassa.<Save>b__6(Object sender, DoWorkEventArgs e)

Tagged with:  

I just realized that unlike other number fields, the default minimum value for the currency field type is 0:

image

While it may not apply to all situations, it is probably that the user may need to enter in a negative number so this value must be replaced, with a relevant negative limit. Otherwise, the user will not be allowed to enter a negative amount.

Tagged with:  

I was entering some sample data when I happened to notice the Delete button on the ribbon contained an arrow.  Hmm, I wondered, what does that arrow do if I push it.  Here’s what it does:

image

Very good. Not only can you delete the currently selected records, but you can also create a bulk-delete job to have those records deleted in the background.

Let’s walk through the process, after you click the Bulk Delete menu.

 

Defining Search Criteria

The first page of the Bulk Deletion Wizard allows you to define the search criteria that will be used to find records that will be deleted:

image

This is the typical CRM Advanced Find screen and like Advanced Find, the criteria will default to that of the current CRM View.

I’ve added an additional check here to find records whose State//Province equals CA.

After you have entered your search criteria, you may click the Preview Records button to verify the results of the search.

Click the Next button when you are satisfied with your criteria.

 

Scheduling the Bulk Delete Job

The next step is to instruct CRM when you would like this bulk deletion job to run, which is done through the following dialog:

image

Other Options

You also have the option of scheduling this job to run on a recurring basis in intervals of: 7, 30, 90, 180, or 365 days.

Finally, you can instruct CRM to email you ( or another CRM user ) when the job has completed.

Submitting the Bulk Delete Job

The final step is to verify the options for the bulk delete job and submit it:

image

 

Verifying the Bulk Deletion Job

You can verify the job ran as expected by selecting:

Settings, Data Management, Bulk Record Deletion.

As you can see from the view below, the

image

Opening the record, we see the specifics for the job:

image

 

We’ll cover the management of recurring system jobs in our next article.

Tagged with:  

CRM 2011: Tracing Sitemap Errors

On April 19, 2011, in CRM 2011, Customization, Dynamics CRM, by Mitch Milam

While working on yesterday’s article, I ran into several issues attempting to import my Sitemap. 

image

Since I wasn’t exactly sure what it was, I decided to turn on CRM Tracing to track down the internal error.  Here is what I found in the trace logs:

Crm Exception: Message: The import file is invalid. XSD validation failed with the following error: "=' is an unexpected token. The expected token is ';'. Line 74, position 74.'.

Really? That sounds bad.

Here is the really cool change they made to CRM 2011 tracing:

<SubArea Id="new_vendorsx" Url="/main.aspx?etn=account&pagetype <<<<<ERROR LOCATION>>>>> =entitylist&viewid=%7b2C598CB7-2E3F-DE11-8035-0050569A36D3%7d&viewtype=1039">

As you can see, the trace file had the exact location of the error.

In this particular case, it turns out I had forgot to encode the ampersand character which was being interpreted as an XML literal and causing the XML validation to fail.

Tagged with:  

CRM 2011 Factoid: Deleting Records

On April 16, 2011, in CRM 2011, Dynamics CRM, by Mitch Milam

When you deleted a record in CRM 4.0, it didn’t physically delete the record at that point in time, it merely marked it for deletion.  Once per day, an automated background process would run to delete any such records.

With CRM 2011, Microsoft changed the architecture so that a delete operation is physically performed when the user clicks Delete.

So, if you are in the practice of searching the database for records whose DeletionStateCode = 2, you may stop that process because that column no longer exists.

Tagged with:  

Hi Everyone,

I am really enjoying Convergence 2011 this week so I thought I would pass along some great news and even greater news about the CRM Migration Assistant, our JavaScript conversion tool.

Great News

In honor of Convergence 2011, we’re offering a 10% discount through Sunday, April 17th. Just enter the code: CONV11 upon checkout.

For those of you at Convergence this year, track me down and give me a business card with CRM Migration Assistant written on the back and I’ll give an even better offer.

Hint: I’ll be at the Microsoft booth between 3:30 and 5:30pm today ( Tuesday ) and around Convergence in general all day Wednesday.

 

Even Greater News

One of the last major features on our product roadmap will be shipping this weekend as well. ( Monday, April 18th, at the latest. )

The new feature will allow you to upload your converted JavaScript directly into CRM 2011 as a series of JavaScript library web resources.

Additionally, it will also modify each entity form to point to the migrated JavaScript library and the functions contained within.

The CRM Migration Assistant is auto-updating so this new feature set will automatically be applied after the update has been posted to the download site.

 

Thanks again for your continued support and if you are in Atlanta this week, say hi.

If you have any questions or comments, please feel free to contact me via email: mitch at crmaccelerators dot net.

Tagged with:  

CRM 2011 SDK 5.0.3 is available

On April 5, 2011, in CRM 2011, Customization, Dynamics CRM, by Mitch Milam

You can download it here.

Here is what is new or updated:

New and updated topics

Description of changes

Microsoft_Dynamics_CRM_2011_SDK_Readme.htm

Updated the readme with new information.

SDK\Bin

Updated assemblies for Microsoft Dynamics CRM 2011 Update Rollup 1. For Microsoft Dynamics CRM Online, updates are installed for you. For other deployment types, you can get Update Rollups from the Microsoft Download Center or from Microsoft Update.

Updated Microsoft.Xrm.Client and Microsoft.Xrm.Portal assemblies for bug fixes.

SDK\HandsOnLabs

Hands-on labs have been updated to work with the RTM build. In addition, the workflow lab has been split into two labs, one for using the Web application workflow designer, and one for creating a custom workflow using Microsoft Visual Studio 2010.

SDK\SampleCode\CS\Client\Ribbon\ExportRibbonXml

Fixed issue where code tried to generate ribbons for custom intersect entities.

SDK\Templates\Xrm.PageScriptProjectTemplate

Included Microsoft Visual Studio extensions and Microsoft Dynamics CRM Solution files to support JScript IntelliSense and limited testing of JScript Libraries that use the Xrm.Page object within Microsoft Dynamics CRM forms. This is called the Xrm.Page Script Library Template.

The Readme.docx file in this location describes how to install and use this solution.

SDK\Tools\PluginRegistration

Updated sample code with bug fixes.

SDK\Tools\WebResourceUtility

Updated tool to fix issue where results view did not allow scrolling to view all results.

Auditing Feature Overview

Added a statement about auditing the IsSecured attribute.

Best Practices for Developing with Microsoft Dynamics CRM 2011

Added information about limiting the metadata retrieved to improve performance: Limit Data Retrieved. Added a new performance section on caching: Caching.

Configure Windows Azure Integration with Microsoft Dynamics CRM

Added information on configuring server security to allow the asynchronous service process to access the Web.

Create, Export, or Import an Unmanaged Solution

Added a Troubleshooting section with a link to Blog Post: Troubleshooting Solution Import for your Upgraded Microsoft Dynamics CRM 2011 Organization.

Customization XML Reference

· Ribbon XML Reference

· Site Map XML Reference

· Form XML Reference

· Saved Query XML Reference

Completed Customization XML reference topics.

How Role-Based Security Can Be Used to Control Access to Entities In Microsoft Dynamics CRM

User and Team Entities

Privilege and Role Entities

Added information clarifying that a user must be assigned to at least one security role.

JScript Libraries for Microsoft Dynamics CRM

Included information to direct developers to the Xrm.Page Script Library Template.

Key to Entity Diagrams

SDK\SampleCode\CS\Metadata\Diagram

Added sample code for generating logical entity relationship diagrams. This updated topic also includes a link to download the generated diagrams for Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online.

Microsoft.Xrm.Sdk.Deployment

Sample Code for Deployment Web Service

Added documentation for the Deployment namespace. Added Windows PowerShell sample scripts.

Plug-in Isolation, Trusts, and Statistics

Added new information on how to change Web access for sandboxed plug-ins.

Register Your Solution with the Dynamics Marketplace

Updated information and included the correct URLs.

Sample: Retrieve Multiple Records Using the REST Endpoint with JScript
SDK\SampleCode\CS\Silverlight\RESTEndpointPagingSilverlight

Sample: Retrieve Multiple Records Using the REST Endpoint with Silverlight
SDK\SampleCode\JS\RESTEndpoint\RESTEndpointPaging

Added two new samples showing how to overcome the limitation on the number of records retrieved using the REST endpoint for Web resources.

Set Field Values Using Parameters Passed to a Form

Included information about what types of Lookup fields can be set using parameters passed to a form.

Supported Extensions for Microsoft Dynamics CRM

Clarified support for development on Windows XP.

User and Team Entities

Corrected information in this topic: user records cannot be deleted, but they can be disabled.

Web Access for Isolated (sandboxed) Plug-ins

Added information on configuring server security to allow the sandbox process to access the Web.

Which Entities are Customizable?

Added link to the CanModifyAdditionalSettings EntityMetadata property.

Workflow and Process Entities

Added information about a change to workflow attributes with Microsoft Dynamics CRM 2011 Update Rollup 1.

Write Code for Microsoft Dynamics CRM Forms

Included Development Tools section to introduce the Xrm.Page Script Library Template.

Tagged with:  

I am working hard to put one of the last major features into my CRM Migration Manager and ran across some interesting issues today and the background information was equally interesting so I thought I’d share:

 

Error: System.Runtime.InteropServices.COMException

Using the exception-handling code ask documented in the CRM 2011 SDK (5.0.2), I received the following error after attempting to execute a query against CRM:

Timestamp: 4/3/2011 10:20:23 PM

Code: -2147220970

Message: System.Runtime.InteropServices.COMException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #7A49F455

Trace:

Inner Fault: Has Inner Fault

Now that’s a scary-looking error but what does it mean and what is that reference number?

I looked around the internet and found some interesting factoids on Develop 1 Limited’s blog which lead me to a little more troubleshooting of my own.

 

Error Reference Number

One of the issues we had with CRM 4.0 is trying to track down the exact error the user was seeing in the trace log file.  After all, it could be megabytes in size and there could be many, many files.

This reference number seems to be randomly generated, is specific to your error, and helps you locate the error within the trace file.

 

Viewing CRM Trace File

So I next turned on Tracing within CRM, reproduced the error, then opened up the trace file and performed a search on that reference number mentioned in the error.

Here is what I found:

[2011-04-03 17:20:23.307] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   25 |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error | ExceptionConverter.ConvertMessageAndErrorCode
>System.Runtime.InteropServices.COMException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #7A49F455: System.Runtime.InteropServices.COMException (0x8007054B): The specified domain either does not exist or could not be contacted.
[remainder of exception goes here but is omitted due to lack of relevance]

 

Conclusion

The issue actually had nothing to do with CRM itself.  It turns out that my domain controller, running as a virtual server, was shutting off and since it could not find the domain controller, CRM could not validate the CRM server or my credentials.

The interesting thing about this is the discovery service worked just fine.  It was only when I attempted to access CRM data that the issue arose.

I hope this helps someone else.

 

References

Develop 1 Limited Blog

Handle Exceptions in Your Code

How to enable tracing in Microsoft Dynamics CRM

Tagged with: