CRM 2011/2013 – System.InvalidCastException: Unable to cast object of type ‘Microsoft.Xrm.Sdk.Entity’ to type

October 22, 2014


I had an odd error today whilst developing and it turned out to be a very frustrating few hours. I was writing a plugin which would work for Lead and Contact and because of this I was using a mixture of late binding and early binding. The late binding was used because I was writing […]


CRM 2011/2013 – use the debugger console to enabled/disable controls on a form

October 21, 2014


I was trying to fix a small bug but I was getting bogged down with the business logic (which I didn’t need/want to change) on the form. The problem was there was lots of business logic which kept disabling the fields I wanted to change. I tried briefly to understand the business logic but it […]

Posted in: CRM 2011, CRM 2013, debug

CRM 2013 – Understanding Business Rules

October 20, 2014


What are business rules Business rules were added to CRM 2013 and a way to provide client side scripting/validating/field or section hiding without having to write any JavaScript.  For context server side customization’s are plugins/workflows (e.g. code written in C# is executed on the server) Business rules are also known as portable business logic (although I […]

Visual Studio 2012 keeps crashing

October 20, 2014


Visual studio has kept crashing for 3 developers over the last few weeks. What makes it worse is there doesn’t seem to be any consistency to the cause of the crashing, it sneaks up suddenly and POW, freezes and crashes before kindly offering to reopen for you. What made it more confusing/annoying was no could reproduce the […]

Posted in: .NET, visual studio

Error – the source file is different from when the module was built

October 17, 2014


This error in the title was very frustrating because it was stopping me test my code. I had a console app to test the plugin code.  I was building the plugin in a separate project and referencing the dell in my console app. I would then step through the code but when it got to the point […]

Posted in: Development

CRM 2013 – using Entity.GetAttributeValue instead of Entity.Contains

October 16, 2014


I found myself writing this tried and tested code, which I have written many times before before you can get a value from the entity attributes you need to check the field is included in the list of parameters. I traditionally use to do this using entity.Contains(“fieldname”), if the field specified exists in the list […]

CRM 2011/2013 – using ITracingServicing and Mocking it up

October 15, 2014


I was writing a plugin and I wanted to step through the code whilst writing it but we had a looming deadline and I didn’t have time to write some unit tests, so I decided just to access the plugin console app. The other plugins were using the ITracingService and I wanted to keep it similar […]