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 slxdeveloper.com, 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.




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