Using the Application object from external code

A question came up today in the SalesLogix BP newsgroups that I’ve been asked a few times before, so I thought it made sense to post the answer I gave here as well. I do plan on writing this up in article format at some point for, but for now this will do.

Question: Can we use the SLX application object (ex. application.getconnection, application.debug.writeln, etc.) from code external to SLX or are there techniques to connect to the DB other than just hard code your ADO connection string or use an external UDL file?

Yes you certainly can. If I recall correctly, you could do this starting in 6.1.1 (not totally sure when it was changed, but I know for a fact in 6.2 you can do this). In pre 6.1.1 versions you could write a script in SLX that returned the value you wanted, such as this:

Sub Main
    Application.BasicFunctions.InvokeSetResult Application.ConnectionString
End Sub

And then get the value from your external code doing this (code in VB6 syntax to keep simple):

Dim slx As Object
Dim connstr As String

    Set slx = CreateObject("SalesLogix.ClientObjix")
    slx.DoInvoke "ActiveScript", "System:MyVbScriptPlugin"

    connstr = slx.InvokeResult

    Set slx = Nothing

That works in essentially any version (well, the Application.ConnectionString part obviously needs to be 6.0 or higher – but that line could be replaced with any other string or method to return connection values) since it uses only ClientObjix to connect to SLX. But, if you’re on 6.2.1 then there’s no problem just using the Application object.

One thing to be aware of is that there are two versions of the SlxApplication class. One that exposes the ConnectionString property (which is actually named SlxApplication2) that cannot be instantiated. The one that you can instatiate (SlxApplication) does not have that property. However you can get a connection object and pull the connection string from that.

Dim slx As Object
Dim cn As ADODB.Connection
Dim connstr As String

    Set slx = CreateObject("SalesLogix.SlxApplication")
    Set cn = slx.GetNewConnection

    connstr = cn.ConnectionString

    Set cn = Nothing
    Set slx = Nothing

Again, this is all done in your C#, VB, whatever code in your own application. With COM in SalesLogix, the client must be running, but it provides an easy way to get the connection details that the client is connected to and use the same in your own application. No need to prompt the user for login details or anything – and that is the way it should be if the intent of your app is to interact or enhance the client in any way.


Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

1 Comment

  1. Is it possible to use the application object in a Perl program ? If "yes", how to use it?



Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!