SalesLogix .NET Extensions Helper Library, manages the embedding of user controls & passing context from SalesLogix to .NET
C#
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Bundle
FX.SalesLogix.NetExtensionsHelper
References/SalesLogix
SampleExtension
.gitignore
FX.SalesLogix.NetExtensionsHelper.sln
LICENSE.txt
README.md

README.md

.NET Extension Helper

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.

Your .NET UserControl will look 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;
			}
		}
	}
}

In SalesLogix, the code for the form will look like this:

'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

Using the provided sample, you'll end up with the following result in SalesLogix (The DataGrid on this tab is a .NET DataGrid control)

Instructions for Use

There is a sample bundle (click the Downloads button on the github repo to access all available downloads) you can install to see it in action and you can view the code on github or pull the source.

To use it you do the following:

  1. Create a .NET UserControl project. Change the base class from UserControl to FX.SalesLogix.NetExtensionsHelper.SalesLogixControl (add a reference to FX.SalesLogix.NetExtensionsHelper.dll)

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

  3. Add whatever else you need on the UserControl such as a datagrid, etc.

  4. Add the compiled UserControl assembly to the .NET Extension Manager

  5. Install the bundle "FX .NET Extensions Helper.sxb"

  6. Create a new tab in Architect (it doesn't need to be a new tab, you can put this anywhere)

  7. Add an include script "System:ExtensionControl Class"

  8. In the Form Open event on the SalesLogix form, add the following code to load the .NET UserControl:

Dim ext ' The extension variable needs to be declared globally on the form

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

    ' Load parameters: "Extension Title", "Extension ClassName", "Parent Handle", "Resize to fill parent"
End Sub
  1. Then in the form's Change event, you'll need to set the ID of the current with the following code:
Sub AXFormChange(Sender)
    ext.CurrentID = Form.CurrentID
End Sub

That's it.