Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, November 22, 2024 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 External Development Forums - General External Development
Forum to discuss general external development topic (related or not to SalesLogix development). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to General External Development | New ThreadView:  Search:  
 Author  Thread: Executing Saleslogix Script from a VB application
Shawn
Posts: 3
 
Executing Saleslogix Script from a VB applicationYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Jun 08 5:18 PM
I have spent almost a week trying to figure out how to execute a Saleslogix Script from an external VB application. I viewed many sample apps; none of
which seemed to work for me. Here is the problem:

I can execute any Saleslogix script as long as it does not involve connecting to the Database by the following code

Set Slx = CreateObject("SalesLogix.ClientObjix")
Slx.DoInvoke "Basic","Personal:myScript"

As soon as the script contains the database stuff(updateing a table in Saleslogix), the application fails.

My question is how do you pass the Database credentials to saleslogix? I tried this:
I made a Reference to the Com object SLAPICom

Dim StrUseName as string
Dim StrPassword as string
Dim strBDE as string

StrUserName = "myUserName"
StrPassowrd = "MyPassword"
strBDE="MyServerName"

Slapi_Loginto strBDE,StrUserName,StrPassword

Thanks
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Executing Saleslogix Script from a VB applicationYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Jun 08 5:37 PM
You're mixing COM calls via ClientObjix and SLAPI - they both are separate and don't interact at all.

For COM (ClientObjix) it uses the running client. All you are doing is telling the code to run inside the already running SLX client, just as if you had invoked it from an internal script.

My guess is that this has nothing to do with the fact that you're invoking it externally, but something else *within the script* is failing. If you run this by invoking it from another SLX script, I'd guess you'll see the same problem.

BTW, what exactly is failing, what is your error, etc?
[Reply][Quote]
Shawn
Posts: 3
 
Re: Executing Saleslogix Script from a VB applicationYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 05 Jun 08 9:36 AM
Ryan

Thanks a million for the response. If in my script I add a line like

strsql = "Update ........."
dBExecute Strsql

When running the VB side, VB gives me Runtime Error 2147418113(8000ffff) - Catasrophic failure
Any idea?

Thanks again
[Reply][Quote]
Shawn
Posts: 3
 
Re: Executing Saleslogix Script from a VB applicationYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Jun 08 11:36 AM
Thanks Ryan.

Even if I write the simplest script, I get the same error when it is invoked within a VB app. This error occurs when I try to do anything which requires
interactions with the Saleslogix Database/tables or scripts.

Is there a sample code which shows how to pass the credentials and execute a script? It can be a very simple script which updates one fieldin a table

As always, thanks for all your help
(BTW we are still on version 5.2 )
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Executing Saleslogix Script from a VB applicationYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Jun 08 5:41 PM
Well, to be honest, it's been years since I've used 5.2 - I don't even think I have a machine around any more with 5.2 on it either. But I can tell you, that back in the day when I did use 5.2 I would do what you're describing all the time, without issues. Does your code look anything like this (not tested code and likely wrong since I haven't typed out old cypress script for quite a long time )

The SLX Script:

Dim hnd As Long

hnd = DBOpenSQL("select top 1 account from account order by createdate desc", True)
InvokeSetResult DBGetValue(hnd, "account")
DBClose hnd


Then the external code (not sure what language you're using so this is just as external VBScript)

Dim slx

Set slx = CreateObject("SalesLogix.ClientObjix")
slx.DoInvoke "Basic", "System:MyScript"
MsgBox "The last account created is " & slx.InvokeResult
Set slx = Nothing


Anyway something like that. Like I said, I can't test this now, but that sort of thing was quite common for me back in the 5.2 days - so at least I know it worked back then.

-Ryan
[Reply][Quote]
John H. Hedges
Posts: 62
 
Re: Executing Saleslogix Script from a VB applicationYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 25 Jun 08 11:30 AM
Is SalesLogix already running when this application starts? Or does the application actually start SLX itself, using a Shell command or some-such thing?

You can't execute SQL commands from within SLX until it's successfully logged in, and even if you pass the credentials on the command line (via the Shell statement), it won't be ready to run Enable scripts for a while after that. Your biggest problem with 5.2 is going to be determining when SLX is ready to accept ClientObjix calls and run DoInvoke's - v.6.2 (and higher) exposes an Application.State property that you can check, but v.5.2 does not.

If you absolutely cannot upgrade to 7.x, and your VB program doesn't require the creation or updating of file attachments in such a way that they sync out, I would strongly recommend abandoning the ClientObjix approach and using SLAPI exclusively. The learning curve is much steeper, though.
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/22/2024 8:21:35 PM