Login / Register  search  syndication  about

          Ryan Farley's Blog

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

Introducing Sublogix - a Simple .NET Repository for SalesLogix Applications

Something that was born out of a project I've been working on is a simple repository for SalesLogix that supports all the way back to SalesLogix v6.2 up to the current 7.5.3, both LAN and Web as well as stand alone applications and utilities. I've named it Sublogix. Sublogix is a simple object model and repository for SalesLogix. Sublogix is not meant to replace the SalesLogix Repository that lives in SalesLogix Web. It's purpose is to give you the ability to work with SalesLogix entity objects no matter what environment you're in.


Recently, I had a SalesLogix LAN project I had to work on, which to be honest, I've not worked in SalesLogix LAN for quite some time. It was a miserable experience. In my opinion, any code that is riddled with SQL statements is bad code. The worst kind of code. Unfortunately, that kind of code is typical for what you see in LAN client development or even in addon utilities for SalesLogix. The problem all comes down to the SalesLogix OLEDB provider, some of it's quirks, and the lack of something better to use. I'm a big fan of Subsonic and Sublogix is inspired by Subsonic's SimpleRepository (I did not attempt to implement something as complete as Subsonic's ActiveRecord, I just needed a simple repository that worked the way SalesLogix works with it's custom ID scheme and so forth that would work via the SalesLogix Provider). To be honest, I didn't intend to name Sublogix after Subsonic, but rather to have a name similar to Subtext, which is a blogging engine with a name that implies it is the engine beneath the text. That's what I wanted in a name for Sublogix. It's underneath the real work you do, doing it's job, and you don't even know it's there.

Some scenarios that are a perfect place to use Sublogix:

  • Custom stand alone applications or utilities for SalesLogix
  • LAN client customizations by way of .NET Extensions
  • Any app where you need to create, read, update, or delete SalesLogix data (and don't have access to the SalesLogix entity model)
  • A web application for an older version of SalesLogix

Let's take a look at some code using Sublogix.

Updating an Account

// Open a the repository
var repo = new Repository(Global.ConnectionString);
// Locate an account and change the Type
var account = repo.GetById<Account>("AA2EK0013096");
account.Type = newValue;
// Save it

Create a new Account

// Open the repository
var repo = new Repository(Global.ConnectionString);
// Create a new Account and set some values
var account = repo.Create<Account>();
account.AccountName = "Test Account";
account.Type = "Test";
account.Mainphone = "6235551212";
// Save it

Locating Contacts using an Expression

// We'll locate a list of contacts using an expression
// and then create an opportunity under each one

var repo = new Repository(Global.ConnectionString);
var contactList = repo.Find<Contact>(x => x.Type == "Customer");
foreach (var contact in contactList)
    var opp = repo.Create<Opportunity>();
    opp.ContactId = contact.Id;
    opp.AccountId = contact.AccountId;
    opp.Description = "Customer Opportunity";

Locating Accounts with an Expression

// We'll locate a list of accounts using an expression
// All accounts with account name starting with "Abb"
var repo = new Repository(Global.ConnectionString);
var accountList = repo.Find<Account>(x => x.AccountName.StartsWith("Abb"));
foreach (var account in accountList)

All of that code looks easy enough, right? No need to every write a SQL statement for SalesLogix applications again. :-) Sublogix works with your own custom tables as well. It comes with some handy T4 templates you just drop into your solution in Visual Studio and your model is instantly generated for you.

What's in the Future for Sublogix?

Sublogix is already something I am using in a production application for a customer. But there is a lot more I plan on adding to it. Here's a short list of what I plan on doing with Sublogix in the near future:

  • Make it available for public use. This will happen soon.
  • Build out the expression factory even more. The current expression factory in Sublogix today is pretty simple. There's a lot more I'd like to do with it.
  • Build in a Linq provider. I'd like Sublogix to fully support Linq to make it even easier to work with
  • Best of all, Sublogix will (in the future) work with both local databases or with SData. You'll be able to write code to work against a local database and then with only changing the line that instantiates the repository to have it work with SData.

Wait, what? Yes, I'd like to be able to use the exact same code to work with both a local SalesLogix database using the SalesLogix Provider as well as work with SData behind the scenes. That would be completely awesome.

So instead of doing this, to create a repository using an OLEDB connection string:

var repo = new Repository(Global.ConnectionString);

You'd do this, to pass an SData URL:

var repo = new Repository(SDataUrl, UserName, Password);

Other than that small change, the rest of the code would work as is. I'm pretty excited to get that built in. Anyway, that is where I would like to take it.

So what are your thoughts? I'd love to hear them. Stay tuned for Sublogix to be available for you to use as well.

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
   Can I Bind an Attachment to a Specific Activity in Infor CRM version 7.54?
Recently I had a user ask if they could bind an attachment to a specific Activity within Infor CRM??
Posted on Jul 07, 2015 by Dale Richter to Infor CRM Questions & Answers
   Infor CRM (formerly SalesLogix) Administrator Locked Out
I thought I had seen all the issues affecting the datalink but this was a new one. We could not login t
Posted on Jun 18, 2015 by Mark Duthoy to SalesLogix Support
   How do I remove users from my Infor CRM system (formerly SalesLogix)?
I had an Administrator ask me for the steps they needed to take in order to remove a user from the Infor
Posted on May 08, 2015 by Dale Richter to Infor CRM Questions & Answers
   Infor CRM (Formerly Saleslogix) v8.1 update 03 and 05- Uncaught Error Scheduling Contact Processes
 In the Infor CRM (formerly Saleslogix) web client, under the Contact area you have the ability to s
Posted on May 07, 2015 by Kris Halsrud to Kris Halsrud's Blog
   Better Code Organization for Infor CRM (Saleslogix) Mobile Customizations
When customizing the Infor CRM (Saleslogix) Mobile client, it's common for the ApplicationModule to g
Posted on May 05, 2015 by Ryan Farley to Ryan Farley's Blog


Twitter Trackbacks for Introducing Sublogix - a Simple .NET Repository for SalesLogix Applications - Ryan Farley's Blog [customerfx.com] on Topsy.com said:

Pingback from  Twitter Trackbacks for                 Introducing Sublogix - a Simple .NET Repository for SalesLogix Applications - Ryan Farley's Blog         [customerfx.com]        on Topsy.com

September 14, 2010 5:40 PM

Mike Boysen said:


Did you realize you have the innovation gene? Why couldn't it be this easy out of the box. Now, on to Outlook integration!

September 15, 2010 6:02 AM

David Nelson said:

I'm sure a number of SalesLogix developers could contribute to such a project.  Have you considered started a sourceforge project?

September 21, 2010 6:45 PM

Ryan Farley said:

Hi David,

I do have plans at the moment to open source this, if/when I do it will go on Github with other Customer FX projects http://github.com/customerfx

I am a big fan of open source, although I've found that the SLX community in general rarely contributes to open source projects. Not sure why that is. Hopefully we can change that and get more to participate. Luckily, Sage has gone that route full-force, which has been great.

September 21, 2010 7:07 PM

Nicolas Galler said:

Looks very promising - looking forward to seeing more of it!!

October 3, 2010 5:06 PM

Ryan Farley's Blog said:

Sublogix, the simple repository and entity model for SalesLogix, is now available via the NuPack package management system! You can now easily get Sublogix to use in your own custom SalesLogix projects. Best of all, you can get it easier than ever using

October 21, 2010 5:04 PM

AK said:

How to add IsNull field restriction? I need something about:

IList<Contract> contracts = repository.Select<Contract>()

    .Where("AccountId", Operator.Equals, SlxAccountId)

    .And( "EndingDate", Operator.IsNotNull )


June 18, 2012 3:42 AM

John Crumpton said:

Hi Ryan,

Do you know of any issues w/ SubLogix and either SalesLogix 8.0 or SQL 2012? Recently, I have used it successfully in several projects. Now I am trying to use it against an SLX 8.0 DB, running on SQL 2012 (my dev system is 2012 Express)... not sure if it's something about the 8.0 DB or the SQL 2012 platform, but I get errors when I run the template. I have tried it against an OOTB 8.0 eval DB, with the same results. It's a null reference exception. After the (failed) build, the SubLogixEntityObjects.cs file is incomplete... it seems to run until it gets to the CampaignTargets view... then the template aborts, leaving an incomplete CS file for the model.

CampaignTargets isn't the first view it comes to (based on the output, I assume it processes them in alpha order), but it is the first one that doesn't follow the naming convention w/ an underscore at the end.



March 4, 2013 9:29 AM

John Crumpton said:

I tried it using the same SLX 8.0 DB, but hosted on SQL 2008... same error. So it seems to be incompatible w/ 8.0.

Any update on the plans to make this one open source? I've been getting a lot of use out of it and would be happyto share any changes that I make.

March 5, 2013 7:30 AM

Ashley Mallia said:

I am considering using Sublogix but will it work with SLX LAN Client v8.0?

July 21, 2013 9:08 PM

Ryan Farley said:

Hi John,

I've used it with v8, but can't recall what results I got with generating the entity classes with the templates. I'm out of the office this week but will test when I get back in a week or so.

But, yes, it should work with v8 (can't think of any reason why it wouldn't off top of my head, but I'll test to be sure).

As far as open source, I'm pushing for that, so hopefully at some point.


July 21, 2013 9:21 PM

Ashley Mallia said:

Making this product open source would be fantastic.

When I regenerated the tt file on a v8.0 database it did not succeed. The expansions fail on several views, just as reported by John Crumpton above.

I was able to get the tt file generating by simply excluding the views that did not generate correctly - just change the tt file with the following:

namespace <#=Namespace#>


<# foreach(var table in tables)

if (table.Name != "CAMPAIGNTARGETSVIEW" && table.Name != "DEPARTMENTVIEW" && table.Name != "OwnerView" && table.Name != "PICKLISTITEMVIEW" && table.Name != "PICKLISTVIEW" && table.Name != "TEAMVIEW")

{ #>

      #region <#=table.PrettyName#>

July 22, 2013 6:53 AM

Ryan Farley said:

Ashley & John,

I have a fix on the way for v8 compatibility. Ashley, thanks for the post. BTW, the fix coming will not require any template changes (although the template changes you've made won't cause any issues with the new version).



July 29, 2013 7:30 PM

Fred Jahnke said:

Hey Ryan,

We are using SubLogix for a little app so a client can update data for our Calling Reps on the clients particular campaign.  We currently are working with the Cloud for a proof of concept program.

Is Sublogix able to link to my Cloud Sdata?

The Repository is looking for 4 parameters, but with the cloud Sdata URL, the example only shows 3(SDataUrl, UserName, Password).


Fred Jahnke

February 27, 2014 12:24 PM

Ryan Farley said:

Hi Fred,

The current version of Sublogix does not yet support use with SData. Sublogix currently requires access to the SQL Server & SLX OLEDB Provider.


February 27, 2014 12:33 PM

Fred said:


 I appreciate the quick response.  

 I will then go in the SData direction.



February 27, 2014 12:43 PM

Fred Jahnke said:

I am have created a mini app in Sublogix, pulling data from the 'test' saleslogix db on our sql(saleslogix_test).  I skipped over dev.  when I try to use the 'live' db(saleslogix_live) I get the following error.  

**Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

- It also happens going to the dev database(saleslogix_dev).


System.Data.OleDb.DataSourceWrapper.InitializeAndCreateSession(OleDbConnectionString constr, SessionWrapper& sessionWrapper)

  at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)

  at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)

  at System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)

  at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)

  at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)

  at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)

  at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)

  at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)

  at System.Data.OleDb.OleDbConnection.Open()

  at Sublogix.Helpers.CommandHelper.ExecuteTable(IDbCommand Command)

  at Sublogix.Repository.GetById[T](String id)

  at SLXSemAppt.DataUtilClass.GetAccount_ByAID(String pAID) in C:\Users\fjahnke\Documents\Visual Studio 2010\Projects\SLXSemAppt\SLXSemAppt\Class\DataUtilClass.vb:line 210

  at SLXSemAppt.cus.Page_Load(Object sender, EventArgs e) in C:\Users\fjahnke\Documents\Visual Studio 2010\Projects\SLXSemAppt\SLXSemAppt\cus.aspx.vb:line 17

  at System.Web.UI.Control.OnLoad(EventArgs e)

  at System.Web.UI.Control.LoadRecursive()

  at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

  at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

  at System.Web.UI.Page.ProcessRequest()

  at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)

  at System.Web.UI.Page.ProcessRequest(HttpContext context)

  at ASP.cus_aspx.ProcessRequest(HttpContext context)

  at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

  at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

  at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)

  at System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)

  at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)

  at System.Web.HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)

  at System.Web.HttpRuntime.ProcessRequest(HttpWorkerRequest wr)

  at Microsoft.VisualStudio.WebHost.Request.Process()

  at Microsoft.VisualStudio.WebHost.Host.ProcessRequest(Connection conn)

  at Microsoft.VisualStudio.WebHost.Host.ProcessRequest(Connection conn)

  at Microsoft.VisualStudio.WebHost.Server.OnSocketAccept(Object acceptedSocket)

  at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)

  at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

  at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

  at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()

  at System.Threading.ThreadPoolWorkQueue.Dispatch()

  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

April 10, 2014 8:20 AM

Ryan Farley said:

Fred, some things to look at. First, make sure that the app pool is 32-bit. Next, check the identity user of the app pool. See if either of those help.

April 10, 2014 10:29 AM

Fred Jahnke said:

I am just debug'ing on my machine yet.  I only change the saleslogix database name(see below) and errors on GetByID?

Working: Dim repo As New Repository("dellcrm2011", "saleslogix_test", "username", "password")

Change and now Not Working:    Dim repo As New Repository("dellcrm2011", "saleslogix", "username", "password")

It is on the GetByID line of code below.

Dim adetail = repo.GetById(Of Account)(pAID)

April 10, 2014 1:05 PM

fred jahnke said:

Ryan, I figured it out. Typo.  Sorry.   Thanks for you time.

April 11, 2014 8:59 AM

Leave a Comment

All contents Copyright © 2015 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