Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Monday, August 25, 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: Passing parameters to a form
sam winters
Posts: 5
 
Passing parameters to a formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 06 Oct 08 7:54 AM
I'm coding some simple scripts that all need to call the same form but with different parameter values; however, I'm unclear as to how to pass those parameters to the form.

Thanks, Sam in Northern Carolina
[Reply][Quote]
Stephen Redmond
Posts: 190
 
Re: Passing parameters to a formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 06 Oct 08 1:23 PM
Hi Sam,

Use Globals:

Application.GlobalInfo("MyParameter1") = MyValue1
Application.GlobalInfo("MyParameter2") = MyValue2

Globals are really useful as they will hold and Variant - including objects.


Stephen
www.slxmaster.com
[Reply][Quote]
sam winters
Posts: 5
 
Re: Passing parameters to a formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 06 Oct 08 4:08 PM
Great idea. I'm trying this approach but the form isn't recognizing the global variable it appears. Here is the calling script:

option explicit

Dim myParm

sub Main()
InvokeMonthlyRptMenu
end sub

Sub InvokeMonthlyRptMenu()

application.GlobalInfo("myParm") = "Wide"
msgbox " set global parameter = " & application.GlobalInfo("myParm")

application.GlobalInfo.Item ("CallingForm") = application.GlobalInfo.Item ("strCurrentForm")
application.GlobalInfo.Item ("strCurrentForm") = "General"
application.BasicFunctions.DoInvoke "view","personal:Monthly Report Filter View"
end Sub



I must be missing something obvious....

[Reply][Quote]
Stephen Redmond
Posts: 190
 
Re: Passing parameters to a formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 06 Oct 08 4:49 PM
Are you saying that the bit:

Application.GlobalInfo("MyParm") = "Wide"
MsgBox "Value set: " & Application.GlobalInfo("MyParm")

Is not working? Because that works fine for me (and always has).

I note that you are setting the Global for "strCurrentForm" after you are assigning the value "CallingForm" - is this an error?

What is the code in the Monthly Report Filter View that picks up the Global - what event are you using? OnOpen, OnChange? Remember that OnChange will not fire if there are no bound fields on the form.



Stephen
www.slxmaster.com
[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: Passing parameters to a formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 06 Oct 08 8:00 PM
Rather than using globals, you have the option of using a main view to display your form and passing stuff to that directly in your code - here's some hacked code from Add Opportunity Product to give you an idea:


Dim objMainView, objDetail

Set objMainView = Application.MainViews.Add("System:Update Opportunity Currency", 0, False) 'DNL
objMainView.BorderStyle = 3
objMainView.Caption = Application.Translator.Localize("Update Opportunity Currency")
Set objDetail = objMainView.DetailsView
if GetMCSystemInfoValue(MC_ChangeOppExchangeRate) = "T" then
objDetail.txtExchangeRate.Enabled = True
Else
objDetail.txtExchangeRate.Enabled = False
End if
If GetMCSystemInfoValue(MC_LockOppRate) = "T" then
objDetail.chkLock.Enabled = True
Else
objDetail.chkLock.Enabled = False
End if
objDetail.lblCurrencyType.Caption = txtCurrency.Text
objDetail.txtPotentialFrom.Text = FormatPrice(FormatNumber(txtExtendedPriceTotal.Text, 2), GetMCValue(MC_On))
objDetail.lblFromType.Caption = objDetail.lblCurrencyType.Caption
objDetail.Script.Init
objDetail.txtHiddenSalesPotential.text = txtExtendedPricetotal.Text/ppeExchangeRate.Text
objDetail.lblToType.Caption = txtCurrency.Text
objDetail.txtPotentialTo.Text = ppeExchangeRate.Text
objDetail.lveChangeTo.Text = txtCurrency.Text
objDetail.txtExchangeRate.Text = ppeExchangeRate.Text
'Need this global to track the ExchangeRate if the user cancels on the Update Opp Currency view AFTER manually changing the value.
Application.BasicFunctions.GlobalInfoSet "UpdateOppCurrency", objDetail.txtExchangeRate.Text 'DNL

If objMainView.ShowModal = mrOK Then
txtCurrency.Text = objDetail.lveChangeTo.Text
ppeExchangeRate.Text = objDetail.txtExchangeRate.Text
Else


etc etc.

Various values on the form "System:Update Opportunity Currency" are set in code before the form is displayed (objMainView.ShowModal displays it to the user as a modal form).

While this may seem more complicated than using globals, you do have more control and the end solution is tidier (IMO).

Phil
[Reply][Quote]
sam winters
Posts: 5
 
Re: Passing parameters to a formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Oct 08 12:22 PM
The MsgBox code in the calling script is exhibiting the value correctly. In the called form, I'm trying to use the global variable in the OnOpen event. A similar MsgBox in the form's OnOpen code exhibits no value.
[Reply][Quote]
Stephen Redmond
Posts: 190
 
Re: Passing parameters to a formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Oct 08 12:29 PM
Did you swap the order of the two lines like I suggested?

From:

application.GlobalInfo.Item ("CallingForm") = application.GlobalInfo.Item ("strCurrentForm")
application.GlobalInfo.Item ("strCurrentForm") = "General"

to

application.GlobalInfo.Item ("strCurrentForm") = "General"
application.GlobalInfo.Item ("CallingForm") = application.GlobalInfo.Item ("strCurrentForm")


My experience suggests that if this is not working then you are doing something wrong. Sorry.


Stephen
[Reply][Quote]
sam winters
Posts: 5
 
Re: Passing parameters to a formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 07 Oct 08 12:33 PM
Stephen, thanks for the quick reply. I tried the code change as well to no avail. I'll look at the other option suggested. Thanks again.
[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): 8/25/2025 2:16:39 PM