Through the SalesLogix .Net extensions a SLX Application wrapper is provided to the extension. Access into the core functionality is very possible including calling the GetNewConnection() method. I actually believe that this is a bad thing and see no reason why this is here. Some of my reasons;

  1. This method call returns back an unmanaged ADO connection (not
  2. There is a property exposed that provides the actual connection string ISlxApplication.ConnectionString
  3. Using the connectionstring paired with the OleDb database objects is the correct way to go in writing code that is in the .net extensions that needs database access
  4. Is the right thing to do


My feeling is there is still a lot of developers out there that understand SalesLogix scripting very well but not .Net and how to write well partitioned code.

So in a nut shell …  in your code do the following;

private string _connectionString;

    void IRunnable.Initialize(ISlxApplication SlxApplication, ILicenseKeyManager LicenseKeyManager)
        _connectionString = SlxApplication.ConnectionString;

    object IRunnable.Run(object[] Args)
        using (OleDbConnection conn = new OleDbConnection(_connectionString))

            using (OleDbCommand command = conn.CreateCommand())
                command.CommandText = “Select count(*) from Account”;
                int count = (int)command.ExecuteScalar();


– Mark

1 Comment

  1. I agree, it is a bad thing to use GetNewConnection from your extensions.

    There are basically two versions of the SlxApplication object. The SlxApplication object is can be instanciated from external code and the SlxApplication2 object which is only allowed to be created from within SLX. When you type “Application.” in a SLX script, you are actually creating a SlxApplication2 object. The reason why this is important is because only the SlxApplication2 object contains the ConnectionString. The SlxApplication object is instanciable externally, but the extension is passed a full SlxApplication2 object from a reference in the running client, making the connection string available.

    Point is, the SlxApplication reference you get in the extension is the same as what you have available in the SLX client scripts, which unfortunately does include the GetNewConnection.

    Have a good day Mark

Leave a Reply