[CRM Online] Avoid attachments using a plugin and weird exception messages: The specified domain does not exist or cannot be contacted. An unexpected error occurred from ISV code
Writing a simple plugin to avoid attachments in Dynamics CRM Online, I have seen weird exceptions messages.
Note: Using Dynamics CRM 2011 Developer Toolkit from CRM 2011 SDK
Find all the code of this example and the CRM solution here
Initially, this is the code of the plugin linked to “annotation” in the Create and Update events (shown just the execute method):
Now, let’s try to attach a new file:
In this case, where an unknown error will happen, I could expect a message similar to this:
Notice I would be able to retrieve traces and see more information.
However, instead of that message, I am getting this other weird error without any trace or useful information: “The specified domain does not exist or cannot be contacted. An unexpected error occurred from ISV code”
To improve this message, I have had to add a try-catch, encapsulate that unexpected exception and throw an InvalidPluginExecutionException:
And now I get the next message:
As you can see, this message is a bit more friendly, but it is not yet the usual desired message we would like seeing with traces, something like this:
Exception messages in attachments for the annotation entity seem to behave differently compare to what we have seen in other entities. Use InvalidPluginExecutionException correctly to guarantee the best result.
If you are using CRM 2011 Developer Toolkit, Plugins inherit from Plugin class. You can improve the error handling in this base class and customise the traces and error logs in the way you better want.
Trying to create a Case (incident) and I was getting the familiar message “Insufficient permissions… contact your administrator”:
My security role seemed to be fine, I got enough permissions to create, update, read,… the case entity. But, the initial error message didn’t help me at all to understand what I was missing.
Then, I just released the details of the error and the reason of the same were in the URL :) :
Exactly, in this case I was missing the read permission in the Subject entity
Hope it helps!
eXtremeCRM 2013 Rome is the Can’t-Miss Conference
for Microsoft Dynamics® CRM Partners
There is no place like eXtremeCRM 2013 Rome. eXtremeCRM is the hub where Microsoft Dynamics
CRM partners come together to forge business relationships, gain knowledge from real-world experiences and dive deep into current and future technologies. For Microsoft Dynamics CRM partner organizations, it is the annual conference to attend to nurture best practices, facilitate business growth, and educate each organization member. The highly anticipated conference will be held in Rome, Italy, 3 – 6 February, 2013.
eXtremeCRM offers role-specific tracks for every member of the partner business. Over 50 sessions are available to those in positions of sales, implementation and development. eXtremeCRM continues its deep focus on technical depth and app development this year and continues its commitment to helping partners grow. To this end, business leaders are invited to attend the eXecutive Summit being held at eXtremeCRM, a workshop-style event that will address key CRM business leadership issues.
With its specialized content and enhanced technical focus (which includes the eXtreme App Challenge), all presented by industry leaders, experts, and innovators, eXtremeCRM 2013 Rome is the investment every partner organization should make.
And, like never before, Microsoft Dynamics will make a BIG splash at eXtremeCRM 2013 Rome. As a corporate sponsor, they have communicated that eXtremeCRM will be their #1 platform to share the latest Microsoft Dynamics CRM strategies and investments with partners.
Here are the sessions I will be presenting:
This session will show you how to easily test your Microsoft Dynamics CRM deployment at the different stages of the development lifecycle. It will cover all angles from designing your code for testability, unit, integration, performance, end-to-end and manual testing. It will introduce you to all the required tools, frameworks and processes you need to create and automate your tests through real life scenarios and practical demos. Demos will showcase the latest technologies such as Visual Studio 2012, TFS 2012, Microsoft Fakes & Test Manager 2012. This session will help you to increase productivity and quality while reducing risk and cost, thus resulting in happy developers and customers through successful deployments.
In this session we will create from scratch a Windows 8 Modern UI application to solve the needs of a fictional company field service representative. The focus of the talk will be to demonstrate the powerful and yet easy to create user experiences that Windows 8 can deliver for Line of Business Applications. During this practical session we will create a complete working example of a Windows 8 App connected to Microsoft Dynamics CRM and talk about some of the amazing possibilities that this new Windows era offers to Microsoft Dynamics.
There are a number of other session offerings I am looking forward to attending. For more information about eXtremeCRM 2013 Rome’s agenda and to register, visit eXtremeCRM 2013 Rome.
Get eXtreme in Rome!
[CRM 2011] Intermittent RetrieveMultiple error: Index was out of range. Must be non-negative and less than the size of the collection
Few weeks ago, I faced an interesting intermittent issue using the CRM Service, specifically with the RetrieveMultiple message. Basically, there was a WCF service wrapping the CRM Service and eventually we were getting the same issue you can find in this MSDN CRM forum post
After some deep investigation, it turned up to be a thread safe issue related to the way IServiceConfiguration and IServiceManagement are shared internally in the CRM libraries. IServiceConfiguration is not safe thread. Another important point to be considered was the early-bound types, which are not guarantee to be thread safe. (See http://technet.microsoft.com/en-us/library/gg326004.aspx).
Finally, a simple solution for this issue was to change the connection configuration:
CrmConnection crmConnection = new CrmConnection("myCRMConnection");
crmConnection.ServiceConfigurationInstanceMode = ServiceConfigurationInstanceMode.PerInstance;
using (CRMContext serviceContext = new CRMContext(crmConnection))
ServiceConfigurationInstanceMode.PerInstance is the key
Related to this topic, I recommend reading the new section Best Practices for Developing with Microsoft Dynamics CRM 2011, which is part of SDK 5.0.12 and newer ones.
Updating from Visual Studio an existing SSRS CRM report (e.g. Activities) may require an external reference to the assembly Microsoft.Crm.Reporting.RdlHelper.dll. This assembly contains several helper functions which can be used from your report.
This assembly can be found in the SSRS report server, normally in the next folder:
C:\Program Files\Microsoft SQL Server\MSRS10.CRMRS\Reporting Services\ReportServer\bin
An easy way to make this reference works is your Visual Studio is to deploy the same assembly into the GAC of your desktop
In my case, I updated the Activities (parent) and Activities Detail (child) reports to include Accounts as part of the regarding. Out of the box, this report only provides the activities linked to Incidents and Opportunities.
Basically, I followed the next steps:
1) Download SSRS report from CRM. Edit Activities report => Actions => Download report and rename it. Repeat the same for Activities Detail report
2) Open Activities report from Visual Studio
3) Deploy RdlHelper.dll in the GAC of my desktop
4) Edit DSActivity dataset query to include accounts (both reports, parent and child)
5) Include new parameter CRM_FilteredAccount (both reports, parent and child)
6) In your new renamed Activities report, update series action to go to new child report. From Design View, right click on the series => Series Properties =>Action => Go to report and selecte the new child report, the one renamed from Activities Detail. Just in the same form, add a the new parameter CRM_FilteredAccount – [@CRM_FilteredAccount]
7) Upload your new reports to CRM.
8) Set up the parent report for the new child report Activities Detail.
I hope it helps.
Basically we have two options to change our hombe page in CRM 2011:
- Per User: Using UI, any user can change his/her own home page. See the next post
- All User: This is not as user friendly because we have to call the webservices (Online or On-Premise) or run a SQL script (On-Premise)
SQL Scritp: Run the next script:
set HomepageArea =‘A’, HomepageSubarea =‘A_1′
Getting a MSCRMTracing error in your Event Log? Probably you have read the next entries. Once you understand them, apply the PowerShell script showed below.
$setting = Get-CrmSetting TraceSettings
$setting.Directory = ‘Drive:\Program Files\Microsoft Dynamics CRM\Trace’
Last week we got a couple of new releases for Microsoft Dynamics CRM 2011: Update Rollup 10 and SDK 5.0.12
Update Rollup 10:
- Windows 8 / Internet Explorer 10 / Office 2013 Preview compatibility
- Many performance and stability-related fixes, including fixes to the CRM Client for Microsoft Outlook
- Contains all hotfixes / updates originally scheduled for release via Update Rollup 9
- Quick Find performance optimizations and EnableRetrieveMultipleOptimization SQL query performance optimizations:
- The Update Rollup 10 Microsoft Download Center page (on August 16th, 2012)
- The Microsoft Update Catalog (on Sept. 11th, 2012)
- The Microsoft Update detection / installation process (on Sept. 11th, 2012)
Some important notes:
- Update Rollup 9 will not be released publically because of a delay in the Q2 Service Update
- Update Rollup 10 is cumulative
- Update Rollup 10 Build number: 5.0.9690.2730
- Prerequisite: Update Rollup 6 installed (build 5.0.9690.1992)
You can find a full summary in the next post from Dynamics CRM in the Field blog:
Some of the features (all details in the Release History section):
- Updated assemblies for Microsoft Dynamics CRM 2011 Update Rollup 10.
- A new Form Scripting Quick Reference that provides simple explanations and examples of the Xrm.Page object methods on a single page.
- Updated the information on Best Practices about service channel allocation performance
- A new topic called Choose your Development Style for Managed Code that describes the choices of tools and classes you can use when you write managed code and provides information to help you decide what is best for your needs.
- A new topic called Create Accessible Web Resources that provides an introduction to creating web resources that offer equivalent functionality for all users so that people with disabilities will be able to use your web resources.
- Added information about quick find query optimizations and a new property “IsQuickFindFilter“ in the FilterExpression class to provide consistency between Query Expression and Fetch XML queries
- Improved authentication helper code and a new sample that demonstrates how to connect to the web services without using helper code.
- Added information about enabling IFRAME communication across domains and use window.postMessage
- Code changes to work in browsers to be supported in a later release, and information to guide you in making those changes.
- Added information about how to manage solution files in source code control using the new SolutionPackager tool
- Using the metadata diagram tool for creating entity model diagrams
- How to authenticate and do basic operations from Java
Some important notes:
- SDK Version 5.0.11 has been skipped
A great week of celebrations, Spain wins the Eurocup and Microsoft awarded me as MVP
These years of hard work with Dynamics CRM have given great results. Now I will enjoy this huge opportunity to carry on growing as professional and give the community all the best.
I wanted to say THANK YOU to Marco Amoedo, my mentor and teacher in this small technical world of CRM, as well as some of my colleagues Wael Hamze and Rhett Clinton, other big professionals from whom I have learnt a lot.