2013 in review


The WordPress.com stats helper monkeys prepared a 2013 annual report for this blog.

Here’s an excerpt:

The Louvre Museum has 8.5 million visitors per year. This blog was viewed about 300,000 times in 2013. If it were an exhibit at the Louvre Museum, it would take about 13 days for that many people to see it.

Click here to see the complete report.

Microsoft Fakes and WebChannelFactory (Unit Test for WCF Service)


Hi,

Recently we wrote a plugin assembly that was calling a rest service using WebChannelFactory.


// wcf interface

[ServiceContract]

public interface IAutoNumber
 {
 /// <summary>
 /// Gets the next number.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <returns>the next incremental value</returns>
 [WebGet(UriTemplate = "getsequencenumber/{value}")]
 [OperationContract]
 string GetNextNumber(string value);
 }

// plugin code

using (
 var webChannelFactory =
 new WebChannelFactory<IAutoNumber>(
 new Uri(dictionaryConfigSettings[Constants.AutoNumberServiceUrl])))
 {
 IAutoNumber client = webChannelFactory.CreateChannel();
 // get the next number from sequence
 autoNumber = Constants.PrefixClient +
 AddPadding(client.GetNextNumber(Constants.EntityNameClient),
 Constants.PrefixClientLength);

if (entity.Attributes.Contains("name"))
 {
 // add the value to the name property bag input parameter for the client record being created
 entity.Attributes["name"] = autoNumber;
 }
 else
 {
 entity.Attributes.Add("name", autoNumber);
 }
 }

Next we had to write the unit test case for the plugin using Microsoft Fakes. 
Below is the code that we used
</span></pre>
using (ShimsContext.Create())
 {
 ShimChannelFactory<IAutoNumber>.Constructor = factory => { };
 IAutoNumber autoNumber = new StubIAutoNumber
 {
 GetNextNumberString = s => { return "12345"; }
 };
 ShimChannelFactory<IAutoNumber>.AllInstances.CreateChannel = factory => { return autoNumber; };
 var preClientCreate = new PreClientCreate();
 preClientCreate.Execute(serviceProvider);
 }

Hope it helps.

Cannot make a call on this channel because a call to Open() is in progress error in CRM 2011.


Hi,

We had developed a Visual Web Part for SharePoint 2013 that used IOrganizationService of CRM 2011. It was all working fine however yesterday it started throwing this error.

After some investigation we realized that the user whose credentials we were using as Client Credentials for the OrganizationService had recently been changed.

Updating it to the correct updated one fixed the issue for us.

Hope it helps.

Using SOAP and OData endpoint of CRM 2013 online in Windows Store App


Connecting to CRM 2013 Online SOAP and OData endpoint through Windows 8 App.

‘_formHierarchy’ is undefined error in CRM 2011


Hi,

We recently faced this issue while opening one of our entity’s form.

This issues comes if we have specified bracket while defining JavaScript function on form.

For e.g. CheckFinancialStatus()

Changing it back to
CheckFinancialStatus resolved the issue.

Hope this helps.

Consuming SOAP and OData endpoints in CRM 2013 Online from external client applications


Consuming SOAP and OData endpoints in CRM 2013 Online from external client applications