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.

About Ryan Farley

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.

Michael Seeger
said:

Hi Ryan,

again, I'm amazed about your ideas and work! "Accidently" I'm actually planning some customisations for two SLX sites and took .NetExtensions into consideration (developed my own VS-Project Teplate for this purpose). I also wanted see what has changed in SubLogix and how I can benefit from using it within .NetExtensions ... finally ;-) ...

Btw: Did you get my message about my SubLogix contribution request/offer? I'm still very interested!

Thanks Michael. I do have several new posts on .NET Extensions coming as well. I have been working with a customer where we've been building out the SLX Windows client exclusively using .NET Extensions, this NetExtensionsHelper library, and Sublogix.

I did get you e-mail about Sublogix. I am just trying to get things organized first so we have a clear direction for future work on it. I'll be in touch.

October 17, 2011 11:47 AM

Michael Seeger
said:

Hi Ryan,

thx for your reply and good to hear that you received my message. I'll wait for your call ;-) ...

A couple of weeks ago I announced the .NET Extensions Helper open source library. I figured it was time for a more complete walkthrough so this post will show a video of how to get the library and use it to embed a .NET UserControl on a SalesLogix account

Can you provide an example of how this would actually work in Production (and I don't mean list records in a data grid)? Customer's need to Add, Edit, Delete, inline Edit.....or is this beyond the helper class?

What your talking about is the implementation of the extension, basically, what you want the extension to actually do. At that point you're just straight .NET, nothing really specific to the extension. The extension helper class provides the plumbing to get your .NET stuff embedded in SLX. After that is done then it's just down to writing the code of what you want your specific extension to do (add or edit records, inline editing, etc).

In the extension you have the connection string to the SLX database, so what I do is use Sublogix in the extension for everything for add/edits/deletes/reads so it's pretty easy from there.