Author Archives: Alex Shlega

Dynamics CRM: Adding a filter to the lookup

Here is a short code sample on how to add a pre-search filter to the lookup function onLoad() { Xrm.Page.getControl(…).addPreSearch(function () { addPreSearchFilter(); }); } function addPreSearchFilter() { var filter = “<filter type=’and’>” + “<condition attribute=’…’ operator=’not-null’/>” + “</filter>”; Xrm.Page.getControl(…).addCustomFilter(filter); }

Design patterns in the real life: abstract factory and factory method

There are two design patterns which are called “factory” patterns: factory method and abstract factory. They are called factories because they produce something. The interesting thing is that there are other creational design patters which are called differenctly, but they still produce something, so, just following this logic, all those patterns could be called factories.… Read More »

Handling N:N relationships in Dynamics CRM plugins

Here is a quick and dirty example of how a plugin could be created to handle N:N associations. A plugin like this would need to be registered for the “Associate” message of “any” entity: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Xrm.Sdk.Client; using Microsoft.Xrm.Sdk; public void Execute(IServiceProvider serviceProvider) {   IPluginExecutionContext context… Read More »

So, why is XRM awesome?

Don’t get me wrong, I’m not going to say that XRM is flawless and/or that it fits anything and anyone. Not at all actually. If you gave me 15 minutes, I could keep complaining about missing XRM features for all that time. However, what I’m going to say is that, with the proper application of… Read More »

Electric Cars – are they worth it?

Every now and then, when our constantly-getting-older (but still not obsolete.. not even quite old yet) car needs some extra attention because of her age, we start looking around to see what could possibly replace her. This time around, there seem to be a few electric cars on the horizon which, I thought, would be… Read More »

Finding software design patterns in the normal world: decorator and proxy patterns

This is a continuation of the original “finding software design patterns in the normal world” challenge. For this one, let’s have a look at the proxy and decorator patterns. The difference between those two seems to be more conceptual than structural. For example, let’s say we have a soldier who can fire. Let’s put that soldier… Read More »

Blogging: what’s in it for me?

What are the reasons I’m blogging? Even if it only happens occasionally? I used to blog in the past for a few years, then I sort of lost connection with that first blog.. And, eventually, I closed it. Now I’m starting to do it again, so why? This blog is not about making money –… Read More »