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!
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.
|
|
|
|
Launcha form how to ...
Posted: 21 Nov 07 2:20 PM
|
I want to create a button on a form.
onClick, open a different sales logix for, let's say, "New Contact Form".
how is this done in SalesLogix? |
|
|
|
Re: Launcha form how to ...
Posted: 22 Nov 07 5:53 AM
|
Hi Alan,
Open SalesLogix Architect --> Go to Toolbox --> Click the item “Button” in the toolbox --> Drag it on the form. Now, paste the below code on the click event of the button...
Set objMainView = Application.MainViews.Add("Add New Contact Account", 0, False) 'DNL objMainView.BorderStyle = 3 objMainView.Caption = Application.Translator.Localize("This is a new contact account form") objMainView.ShowModal Set objMainView = Nothing
HTH
Have a great day!
Sincerely, Dinesh _______ Greytrix It's time to think outside the box. GUMUTM: Migration and Integration solutions for Sage CRM, Sage CRM.com, Sage Accpac, Sage Pro, MAS 90/200/500 E-mail: sage@greytrix.com | web: www.greytrix.com/sage
|
|
|
| |
|
Re: Launcha form how to ...
Posted: 26 Nov 07 8:15 PM
|
It may be a stupid question, but is your new main view actually called "Add New Contact Account"?
Also, you need to prefix the name of the main view by the view's family, eg
Set objMainView = Application.MainViews.Add("System:Select Competitors", 0, False)
where System is the family for the Select Competitors view. |
|
|
|
Re: Launcha form how to ...
Posted: 27 Nov 07 3:39 AM
|
Hi Alan,
Yes Phil is correct, you will need to add the family to the Viewname i.e. "System:Add New Contact Account". This should work for you.
Likewise, do the same changes if you have your customized form i.e. "Family:ViewName"
HTH
Have a great day!
Sincerely, Dinesh _______ Greytrix It's time to think outside the box. GUMUTM: Migration and Integration solutions for Sage CRM, Sage CRM.com, Sage Accpac, Sage Pro, MAS 90/200/500 E-mail: sage@greytrix.com | web: www.greytrix.com/sage
|
|
|
|
Re: Launcha form how to ...
Posted: 28 Nov 07 12:36 PM
|
ok next question ... how to store the variables on that form to the salelogix data base? |
|
|
|
Re: Launcha form how to ...
Posted: 28 Nov 07 5:03 PM
|
This is starting to feel like a SalesLogix dev class - have you tried looking at other areas of the system and trying to work it out from there? What you are trying to do is fundamental to the product and there are hundreds of examples within the product itself.
PP |
|
|
|
Re: Launcha form how to ...
Posted: 28 Nov 07 6:59 PM
|
Actually I have, and I have purchased the DevLogix book. My opinion, forgive me if I am mistaken, was that was an appropriate question for this forum since the topic is scripting. That is what attracted me to this site, the opportunity to share my questions with others. I am sure that one I get up to speed on this product that I will be a contributor but right now I am a newbie to this product
This is a proprietary product and my greatest problem in navigating it is lack of documentation. In fact I spent at least an hour trying to find the answer to no avail before I posted this question.
I have successfully created a contact form. There are text variables on the form such as txtFirstName, txtLastName, etc
now have a Save button and what I what to do is something like this
Sub OnButtonSave(sender)
Some_SalelogixContactObject_For_This_Account.FirstName=txtFirstName
Some_SalelogixContactObject_For_This_Account.Update
End Sub
Is this the right approach or should I do something like this
Sub OnButtonSave(sender)
execute_sql__insert_contact_query_for_this_account
End Sub
in other words, is an object oriented approach most appropriate or a sql insert approach?
Either way I am still wading through the product trying to find particulars regarding this.
This is almost a "Hello World" question and I have found multiple examples regarding select queries , but not what I am looking for.
I have this legacy code which is SQL oriented, and I am now trying to figure out what is deprecated and what is not.
I guess I can translate this to the new syntax, if i can figure out what is deprecated
option explicit
Dim sSQL As String Dim fName As String Dim lName As String Dim cContID As String Dim cAcctID As String Dim cAddID As String Dim lHandle As Long Dim sSecCodeID As String Dim sAcctMgrID As String Dim cEmail As String Dim cPhone As String Dim cForm As String
Sub Main
fName$ = Trim(GetPropertyOf("txtFirstName", "Text")) lName$ = Trim(GetPropertyOf("txtLastName", "Text")) cEmail$ = Trim(GetPropertyOf("txtEmail", "Text")) cPhone$ = Trim(GetPropertyOf("txtPhone", "Text")) cAcctID$ = Trim(GetPropertyOf("pnTicket:leAccount", "LinkID")) GlobalInfoFor "cForm", cForm$ cForm$ = Left(cForm$, Instr(1, cForm$, ":"))
' Make sure contact is not a duplicate sSQL$ = "SELECT Count(contactid) rcnt FROM contact WHERE lastname = '" & lName$ & "' AND " sSQL$ = sSQL$ & "firstname = '" & fName$ & "' AND accountid = '" & cAcctID$ & "'" lHandle& = DBOpenSQL(sSQL$, True) If DBGetValue(lHandle&, "rcnt") > 0 Then DBClose lHandle& MsgBox "That contact is already a record for this account. Please select the existing contact
record.", 64, "SalesLogix" Exit Sub End If DBClose lHandle&
sSQL$ = "SELECT seccodeid, accountmanagerid FROM account WHERE accountid = '" & cAcctID$ & "'" lHandle& = DBOpenSQL(sSQL$, True) sSecCodeID$ = Trim(DBGetValue(lHandle&, "seccodeid")) sAcctMgrID$ = Trim(DBGetValue(lHandle&, "accountmanagerid")) DBClose lHandle& If fName$ = "" Or lName$ = "" Then MsgBox "You must specify a first and last name to continue.", 48, "SalesLogix" Exit sub End If
cContID$ = Trim(DBCreateIDFor("contact")) cAddID$ = Trim(DBCreateIDFor("address")) sSQL$ = "INSERT INTO
contact(contactid,accountid,createuser,modifyuser,createdate,modifydate,firstname,lastname," sSQL$ = sSQL$ & "email,workphone,seccodeid,accountmanagerid,addressid,shippingid) " sSQL$ = sSQL$ & "VALUES('" & cContID$ & "','" & cAcctID$ & "','" & CurrentUserID & "','" &
CurrentUserID & "'," sSQL$ = sSQL$ & "GetDate(),GetDate(),'" & fName$ & "','" & lName$ & "','" & cEmail$ & "','" & cPhone$ &
"'," sSQL$ = sSQL$ & "'" & sSecCodeID$ & "','" & sAcctMgrID$ & "'," sSQL$ = sSQL$ & "'" & cAddID$ & "','" & cAddID$ & "')" DBExecuteSQL sSQL$
sSQL$ = "INSERT INTO address(addressid,entityid) VALUES('" & cAddID$ & "','" & cContID$ & "')" DBExecuteSQL sSQL$
SetPropertyOf cForm$ & "txttFirstName", "Text", fName$ SetPropertyOf cForm$ & "leContact", "LinkID", cContID$ SetPropertyOf cForm$ & "leContact", "Text", lName$ SetPropertyOf cForm$ & "leEmail", "Text", cEmail$ SetPropertyOf cForm$ & "leWorkPhone", "Text", cPhone$ CloseCurrentView False
End Sub
Thanks for any tips or suggestions you can give me.
Alan
|
|
|
|
Re: Launcha form how to ...
Posted: 28 Nov 07 9:00 PM
|
Thanks Alan
Happy to see that my suspicions were unfounded & sorry if I offended you.
I would like to provide a longer answer to your post, but at the moment I'm a bit busy. But here are some pointers.
1) The SQL / recordset approach is the way to go. For example, check out the standard Add New Contact Account form - particularly the following subs: SaveContactAccountDetails (Case 0 - contact for account) which then calls InsertNewContact.
2) Your legacy script will be a pain to convert - everything that you see there that is not standard VBScript is not going to work on an Active form. Deprecated is the wrong word to use here - SLX used to use this coding language (Cypress Enable Basic) about 5 years ago (and there is still quite a bit of it about). Now SLX code is written in VB script.
PP
|
|
|
|
Re: Launcha form how to ...
Posted: 28 Nov 07 9:02 PM
|
Ok thanks for that, it gives me a clue as to how to approach this.
No offense taken |
|
|
|
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!
|
|
|
|
|