Login / Register  search  syndication  about

          Ryan Farley's Blog

Ryan Farley on .NET Development with a focus on CRM Development for SalesLogix

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:

public partial class UserControl1 : FX.SalesLogix.NetExtensionsHelper.SalesLogixControl
{
    private void UserControl1_SalesLogixRecordChanged(string RecordID)
    {
        using (OleDbConnection conn = new OleDbConnection(this.SlxApplication.ConnectionString))
        {
            conn.Open();
            using (OleDbDataAdapter da = new OleDbDataAdapter(string.Format("select lastname as LastName, firstname as FirstName, type as Type from contact where accountid = '{0}'", RecordID), conn))
            {
                DataTable table = new DataTable();
                da.Fill(table);
 
                dataGridView1.DataSource = table;
            }
        }
    }
}

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:

'Including Script - System:ExtensionControl Class
option explicit

Dim ext

Sub AXFormOpen(Sender)
    Set ext = new ExtensionControl
    ext.Load "SampleExtension", "SampleExtension.UserControl1", Form.HWND, True
End Sub

Sub AXFormChange(Sender)
    ext.CurrentID = Form.CurrentID
End Sub

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.

Visit the NETExtensionHelper home on github 
Grab everything you need, the assembly, the SalesLogix bundle, and a sample project from the Downloads section.


Best Of All, It's Open Source

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.

What's This?
  
Bookmark and Share

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.

View the SalesLogix Mobile Seveloper Series
View the SalesLogix SData Developer Series
View the Git for the SalesLogix Developer series



Related Content
   Infor CRM (formerly Saleslogix) Web- Dependency Lookup OnChange Event Not Working Correctly
In the Saleslogix 8.1 web client the dependency lookup still has a problem with the OnChange event. 
Posted on Nov 26, 2014 by Kris Halsrud to Kris Halsrud's Blog
 
   Confirming Actions With an "Are you sure?" Prompt in Infor CRM (Saleslogix)
I'm not a huge fan of bugging end users. I figure, if an end user clicked something, he or she meant
Posted on Nov 18, 2014 by Ryan Farley to Ryan Farley's Blog
 
   Infor CRM (formerly Saleslogix) Statement of Direction
Learn more about the future of Infor CRM. Recently I received my login information for the Infor Partn
Posted on Nov 13, 2014 by Brianna Ojard to The Inbox
 
   Xbar for InforCRM (formerly SalesLogix) Installation Issue
After installing Xbar 1.1 on a Windows 2008 R2 server the Xbar application was not available in Outlook 2
Posted on Nov 11, 2014 by Mark Duthoy to SalesLogix Support
 
   Programmatically Using Security Roles and Secured Actions in Infor CRM (Saleslogix)
In most places in the Infor CRM (Saleslogix) web client, it's pretty easy to use security roles. You
Posted on Nov 07, 2014 by Ryan Farley to Ryan Farley's Blog
 
Comments

 

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!

Regards,

Michael.

October 14, 2011 1:33 AM
 

Ryan Farley said:

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 ;-) ...

Regards,

Michael.

October 18, 2011 9:04 AM
 

Ryan Farley's Blog said:

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

October 27, 2011 11:15 AM
 

RJ Samp said:

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?

December 9, 2011 9:15 AM
 

Ryan Farley said:

Hi RJ,

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.

December 9, 2011 11:12 AM
 

Steve Yam said:

Where is "ExtensionControl Class"?

I cannot find it.

February 12, 2012 9:28 PM
 

Ryan Farley said:

Steve,

This script is available as a part of the Github repository. You can download the bundle from here: github.com/.../downloads

-Ryan

February 14, 2012 5:32 PM
 

Steve Yam said:

Hi Ryan,

2) In the .NET UserControl, wire-up the event SalesLogixRecordChanged from the base class

What does it really mean for wire-up? In what format?

For example if my control class name is xxx then the method shoul be xxx_SalesLogixRecordChanged, is it?

February 19, 2012 6:31 PM
 

Steve Yam said:

I got what you mean, please ignore it.

Thanks a lot Ryan, nice stuff!

February 19, 2012 6:41 PM

Leave a Comment

(required)  
(optional)
(required)  
Add
All contents Copyright © 2014 Customer FX Corporation
Customer FX Corporation
2324 University Avenue West, Suite 115
Saint Paul, Minnesota 55114
Tel: 800.728.5783

  Follow @CustomerFX on twitter
Follow the best news, tips, and articles
  Subscribe to Customer FX on youtube
Watch SalesLogix tutorial videos from Customer FX
Login / Register