Announcing the Open-Source SalesLogix .NET Extensions Helper Library

If you’re working in the SalesLogix Windows (LAN) client, why not make as most use as possible of a modern development environment, language, and tools? The SalesLogix .NET Extensions feature in the SalesLogix Windows client is one of the best, and likely least used, features in the SalesLogix Windows client development story. A choice bewteen using an out-dated development environment and VBScript, with no possibility of using source control or a true multi-developer experience verses using Visual Studio, with source control, a modern language and framework where the sky is the limit? I’ll take the latter any day. Still not convinced? The .NET Extensions Helper library comes to the rescue. This new open source project from Customer FX will make embedding .NET controls in SalesLogix a breeze.

Overview & How To Use

The .NET Extension Helper is a library that will do all the heavy lifting to embed controls in SalesLogix. All you do is have your UserControl inherit from the FX.SalesLogix.NetExtensionsHelper.SalesLogixControl and then use a script class in SalesLogix to load the control and set the record context.

Let’s consider a very simple example of a .NET Control on an Account tab. You want to display the current account’s contacts in a grid on this tab. Your .NET UserControl code will look something like this:

So, what are we looking at here? Basically, there’s extra code in that example that opens an ADO.NET connection to the SalesLogix database and gets a DataSet to bind to a DataGridView, but the important parts there is that the UserControl inherits from a special base class named “SalesLogixControl” and then wires up an event called SalesLogixRecordChanged which passes in the current record’s ID value. Whenever the record changes in SalesLogix, this event is fired and you’re passed the record ID. Simple.

The above is the .NET side of things. There’s only two lines of code needed in SalesLogix to drive this. In the example we have above, the SalesLogix form (the actual form in SalesLogix hosting this control), would include the following code:

The code above simply includes a VBScript plugin named “ExtensionControl Class”. Then, in the form’s Open event it creates an instance of the ExtensionControl class and then tells it which .NET Extension to load, and passes the Windows handle (HWND) of where to embed the control (in this case it passes the handle, or HWND of the form itself). The “True” at the end tells it to resize the control to fill all available space in that area. When the record changes, it passes that into the class which fires the event in your .NET UserControl. That is it.

What you’ll end up with is this:

There are other things available as well which you can make use of, such as passing a Subroutine from your VBScript to the .NET UserControl as a callback function. I’ll discuss more about that later.

One of the biggest benefits you’ll have when using this, and .NET Extensions in general, is that you’ll get to use Sublogix for all data access which will drastically speed up development time. I’ve been working with a customer where we’ve been building out their SalesLogix Windows client using exclusively .NET Extensions and this library with Sublogix and it’s actually been enjoyable to work with. I’ve not been this happy working in the Windows client, well, ever.

Where Can You Get It?

All code for this is on github as an open source project. You can grab the .NET assembly and associated SalesLogix bundle from there and start rolling. I’ll try to put together a sample video of how to go from download to first use next week.

As I mentioned above, this is an open source project. If you’re using .NET Extensions and have some good ideas to add, I’d love to see some contributions. Just clone the repository, make some changes and then submit a pull request.

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix since 2001 and believes in sharing with the community. He loves C#, Javascript, Python, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.