Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, July 8, 2025 
 
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!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Making a global function
Andrew Grandin
Posts: 272
 
Making a global functionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Nov 09 6:12 AM
I have a chunk of SQL executed on a button click in which i do a count on an extension table where accountid = 'id'.

If count is 0 i do an insert, if count is 1 i do an update. I thought this would only be used once but i have ended up copying it into 4 forms. How do i make it a global function that can be called from any form script so i dont have to repeat the code?
[Reply][Quote]
John Gundrum
Posts: 632
Top 10 forum poster: 632 posts
 
Re: Making a global functionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Nov 09 9:07 AM
What you can do is use Architect to create a new script file called "c_custom" or whatever name you want - just keep the "c_" to follow standards. Put the procedure in there and then reference this new file in the forms you want to use it. This will give you a lot of flexibility if you change it later on and also allows you to create other global procedures all in the one file. Makes bundling easier as well.

John G.
[Reply][Quote]
Andrew Grandin
Posts: 272
 
Re: Making a global functionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Nov 09 9:13 AM
hi john, thanks for your reply. If i create this custom script file and use it to store several functions how would i call one from within a forms script?
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Making a global functionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Nov 09 9:23 AM
Once you have built your script, you have to Include it on your form or script.
[Reply][Quote]
Andrew Grandin
Posts: 272
 
Re: Making a global functionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Nov 09 9:30 AM
Sorry i should have worded by question better. What i meant was do you just call it just as 'function name' or do you have to do 'pluginname.scripts.functionname' etc.
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Making a global functionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Nov 09 9:34 AM
No need to do that.

On the Script tab of the Form (or on your Script file if using on a VBSCript), you "Include" your script.
By including the script, it means that the file gets appended to the actual script before it compiles, so you just need to call your function directly.
Do make sure that you don't have conflicting function names.

[Reply][Quote]
Andrew Grandin
Posts: 272
 
Re: Making a global functionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Nov 09 2:53 AM
hi guys, one final question on this:

In my inlcude script i do an sql statement that returns either a count of 0 or 1.

If count is 0 then an insert sql statement is executed that will always be the same so i can have this in my include script.

But if a count of 1 is returned then what sql statement is executed next depends on the form that is calling my function.
Will my form script know what count is? so after i call my function i can go straight into "if count = 1" or will i have to return the count from my include script to the form via some code/variable?
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Making a global functionYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Nov 09 1:54 PM
I would pass a 2nd Parameter, the MODE of the call.....or the Form Name of The Sending Entity.

Then your receiving script can 'know' how to behave... CASE Structure could handle that

Select CASE paramFormName

CASE

CASE


END SELECT
[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 © 2025 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): 7/8/2025 5:40:04 PM