Friday, March 23, 2012

IFD Configuration

While setting up IFD, we had issues in enabling the claims for CRM 2011. After trying to enable claims for CRM 2011 through Microsoft Dynamics CRM 2011 Deployment Manager when we trid to browse the URL: https://XYZ.com/FederationMetadata/2007-06/FederationMetadata.xml we were getting one of the following errors:

- HTTP 503 Service Unavailable error.
- HTTP 404 Not Found error.

When "FederationMetadata/2007-06/FederationMetadata.xml" is requested through the browser CRM website, it has the rule that rewrites the URL to handlers/Federation Metadata.ashx. So when one gets such types of error then it means IIS URL Rewrite module is not rewriting the URL correctly.

The solution for this issue is to re install the IIS URL Rewrite.

If the reinstallation of IIS URL Rewrite does not resolve the issue. The Issue could be due to Reserved URL. To find the Reserved URL follow the below given steps.

a) Open Command Prompt.
b) Type the Command NETSH HTTP SHOW URLACL.
c) This command will show all the reserved URL's.
d) If you get any reserved URL with error as given below.

Reserved URL : https://ABC:443/
Can't lookup sid, Error: 1332
SDDL: D:(A;;GA;;;S-1-5-80-2246541699-21809830-3603976364-117610243- 975697593)

e) Then we have to delete each URL for which we get such type of error as given above using the below command. Please provide the full URL for which you get the error in the command Prompt.

netsh http delete urlacl url=https://ABC:443/

f) After that again run the command to check if the reserved URL is still having an error message through command NETSH HTTP SHOW URLACL.

g) Repeat the step (e) for each URL for which you are getting the error.

h) After deleting all the Reserved URL through the Command,do IIS RESET on CRM server.

i) Configure CLAIMS again using Deployment Manager on CRM 2011.

j) Now try to access the federation Url “FederationMetadata/2007-06/FederationMetadata.xml"again.

We have refereed the blog http://blogs.msdn.com/b/emeadcrmsupport/archive/2011/05/13/we-receive-http-errors-while-accessing-the-crm-federationmetadata-url.aspx to resolve the issue.

The above listed steps should resolve the issue.

Tuesday, March 13, 2012

N:N association

When we have to associate the records we normally use AssociateRequest but while associating campaign with campaign related items such as Campaign, Marketing List, Product, or Salesliterature it doesn’t work.

For achieving this we have special Message made for Campaign called AddItemCampaignRequest.
Below we have provided the code that will associate the Campaign with Campaign Items.

//Add Item to Campaign
AddItemCampaignRequest req = new AddItemCampaignRequest();

// Specify the Campaign Id
req.CampaignId = new Guid(CampaignId)

// Specify the Logical name of the entity to which we want the Campaign to be associated
req.EntityName = entity.LogicalName;

// Specify the Id of the entity to which we want Campaign to be associated
req.EntityId = new Guid(EntityId)

// Execute the request
AddItemCampaignResponse resp = (AddItemCampaignResponse)_service.Execute(req);

We can associate Campaign, Marketing List, Product,
or Salesliterature with the Campaign through the AddItemCampaignRequest message.

To use this message, pass an instance of the AddItemCampaignRequest class as the request parameter in the Execute method. To perform this action, the caller must have access rights on the campaign entity instance.

Same we can associate the Campaign Activities with the Marketing Lists through the AddItemCampaignActivityRequest as given in the below code.

// Create the request object.
AddItemCampaignActivityRequest add = new AddItemCampaignActivityRequest();

// Set the properties of the request object.
add.CampaignActivityId = new Guid(CampaignActivityId);

// Specify the List Id to which we want Campaign Activity to be associated
add.ItemId = new Guid(listId);

// Specify the Logical name of the entity to which we want the Campaign Activity to be associated
add.EntityName = EntityName.list;

// Execute the request.
AddItemCampaignActivityResponse added = (AddItemCampaignActivityResponse) service.Execute(add);

The Marketing List being added must have already been added to the campaign otherwise error will be thrown and Marketing List will not be associated with Campaign Activities.

Hope this helps!!!

Monday, March 5, 2012

Experiences from the MVP Summit!

Well, this was one travel that I had not planned for. But today I am happy that I did not skip it. This was my first MVP summit after being awarded MVP in January this year and it was an enriching experience.

I was one of the 41 CRM MVPeeps that were present at the summit and I was the only one from India in the CRM Group. The group had representation from most parts of the world and it was great to see the reach and adoption of CRM across the world.

There were many sessions revolving in and around CRM and unfortunately not much can be shared here to due to the NDA. All that can be said though is CRM is heading the right direction and we are in safe hands :)

It was a pleasure to hear the product team speak about the future of the product and thier vision for the product. It was good to know we could share our concerns and they would be addressed and that we were not just there to hear them talk but the product team was listening to us as well and that as MVP we were really a valuable community for them.

Amy did a really great job at organizing the sessions and many thanks to her to make sure we are all well looked after :)

Besides the sessions which were by the way not all work but actually a lot of fun, there were also other parties organized in the evenings. The closing ceremony was held at Centurylink fields. There was a fireworks show and we had a chance at the ball on the fields.

A very big thanks to all MVP's to make us first timers feel welcome. Looking forward to Convergence that starts 18th March and I expect that to be an equally enriching experience and I really look forward to meeting all my friends back again!



Tuesday, February 28, 2012

Issue with plug-in in CRM 2011

We had a requirement to do some calculation and update self record of custom entity. We have created a plug-in and registered it on post operation of update event. The code was reading the post image, updating some fields and updating the same.

The plug-in was working fine for single record. But when two records are saved simultaneously, the plug-in was giving below errors randomly.


1. "ValidateOpen - Encountered disposed CrmDbConnection when it should not be disposed"
2. "You cannot create a SqlExecutionContext from another SqlExecutionContext on which OnBeginRequest has not been called"
3. " System.InvalidOperationException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #58919D7E"
4. "System.NullReferenceException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #1638FFA8"

When we checked in the Event viewer then we got that whatever error we get from CRM the Event viewer shows "System.InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first." error.

After searching on net we found that CRM does not re-initialize the plug-in object again, it uses the same object. In the plug-in, ignore to use class level variables. We had created service object at class level so it was using the same service object for retrieving and updating.

Also we were reading post image and updating the post image as it is. This was also creating a problem. Please create a new object of Entity and then set only those fields which you want to update. Then update the record.

Sometimes this plug-in takes too much time as it was doing so many calculation. We were getting the "Query execution time of 30.1 seconds exceeded the threshold of 10 seconds. Thread: 4; Database: inogic_MSCRM " error when plug-in takes time. To resolve this, please add below keys in the registry on CRM server.
1) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM\OLEDBTimeout
a. In seconds
b. The OLEDBTimeout value controls the SQL time-out value that is used for a single SQL query
c. Set it to 60 seconds


2) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM\ExtendedTimeout
a. In milliseconds
b. The ExtendedTimeout value controls the ASP.NET time-out value
c. Set it to 1,000,000


3) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM\NormalTimeout
a. In milliseconds
b. Specifies the SOAP call timeout for most operations
c. Set it to 300,000

Hope this helps!!

Wednesday, February 22, 2012

How to debug XAML bindings in Silverlight 5

Microsoft has released Silverlight 5 !! A new feature is available in Silverlight 5 and it is XAML Data Binding debugging. For any data driven application with declarative data binding, within XAML, this brand new feature is the significant in various ways.

Prerequisites:


Silverlight 5 toolkit
Silverlight 5 Developer Runtime
Visual Studio 2010 SP1

The example demonstrated here implements basic XAML data binding. Below we have specified both the scenario when binding is correct and incorrect.

In below example we have given a simple binding for DataGrid.

When Binding is Correct:




Now you can apply a breakpoint to the binding syntax. Once the break point is applied, it hits the breakpoint whenever push and pull is triggered for that control. The below image shows the breakpoint applied within XAML


The XAML editor will not allow you to set breakpoint anywhere else other than Binding syntax.
Once Breakpoint is set, start debugging and wait for the compiler to hit the breakpoint.


You can find the debug information from Local tab.


The information shows up a BindingState object holding complete binding context information of the control. As in the above image, the BindingState value is UpdatingTarget so this way it shows that the binding is pushing data to control.

Going through the debugging information, it shows the complete picture on the nature of data and binding


Now another thing to know is, on TwoWay binding scenario once you change the data, The breakpoint again gets a hit as the binding source is getting updated. And the debug information shows the Binding state as Updating Source status. The breakpoint again gets a hit as the binding source is getting updated. And the debug information shows the Binding state as Updating Source status.


When Binding is Incorrect:

When binding is incorrect you will get the error while debugging the binding.


This will help you to find the incorrect bindings in your XAML.
Hope this helps you to get acquainted with the new feature of Silverlight 5