Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Wednesday, June 18, 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: inserting data in to account table along with new fields
Vamsi
Posts: 39
 
inserting data in to account table along with new fieldsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Apr 07 2:46 PM
Dear all,

I am beginner to saleslogix. Right now i am working on saleslogix 7.0.I need to insert data for 20 more user fields in account table. This twenty user fields i have designed on another form(not on add contact account form due to not having place).So i am calling this new form by placing a button called "next" in add contact account form. So after i punched data what code i have to write in the save button of newly created form so that entire data should enter in to account table (along with data in the earlier(add contact account screen) )

pls help me

vamsi
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: inserting data in to account table along with new fieldsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Apr 07 12:27 AM
Vamsi:

There are several ways to do this, specially depending on what you have in your hands.

In your situation, I would've started by having the "Next" button commit the Data for the Contact and Account, and retreiving the new IDs. Then if the data for the addtl 20 fields was account related, I would've created an Account Based form and used the ShowViewForRecord function to load the view thus having it bound to the new Account record ID. Had you done this, then you would have nothing to do but to Save the form by the OK button

Assuming that the Form you have is not bound to the DB, then you would have to use ADODB code to save the data.
You would still need to get the Account (and/or the Contact) ID and then just create the necessary records via ADODB.


The code below is just an example, and is only for illustration, I have not tested it, so even the sintax might be slightly off:

Dim strSQL
Dim rec
Dim con

strSQL = "SELECT * FROM ACCOUNT2 WHERE ACCOUNTID = '" & myNewAcctID & "'"

Set con = Application.GetNewConnection
Set rec = con.Execute strSQL
If rec.RecordCount = 0 then
'Need to create record on this table
rec.AddNew
rec("ACCOUNTID").Value = myNewAcctID
rec("CREATEDATE").Value = Application.BasicFunctions.DateToIso(Now())
rec("CREATEUSER").Value = Application.BasicFunctions.CurrentUserID
End If

rec("MODIFYDATE").Value = Application.BasicFunctions.DateToIso(Now())
rec("MODIFYUSER").Value = Application.BasicFunctions.CurrentUserID

rec("CUSTOMFIELD1").Value = myVal1
rec("CUSTOMFIELD2").Value = myVal2
..
rec("CUSTOMFIELD20").Value = myVal20

rec.Update

Set rec = nothing
Set con = nothing


[Reply][Quote]
Todd Hardin
Posts: 43
 
Re: inserting data in to account table along with new fieldsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Apr 07 2:31 AM
fiogf49gjkf0d
Suggest you do not use string formatted datetime values when dealing wiht ADO objects (fields and parameters).
When dealng with raw SQL statments, then must use IDO formatted DateTime strings with SLX, however ADO objects are data typed.

Rather than
rec("CREATEDATE").Value = Application.BasicFunctions.DateToIso(Now())

Use
rec("CREATEDATE").Value = Now()

This clarification/recommendation came to me via the guy that developed the SLX OleDB Provider so I consider it to me pretty solid advice.
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: inserting data in to account table along with new fieldsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Apr 07 3:29 AM
Good catch.

I don't know where I had my head while typing that...

... Never the less, I did add a disclaimer to my sample...
[Reply][Quote]
Bob (RJ)Ledger
Posts: 1103
Top 10 forum poster: 1103 posts
 
Re: inserting data in to account table along with new fieldsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Apr 07 8:17 AM
As Per Todd's post...
A - When using an ADO Recordset, Always pass in proper typed values. This is especially true when refering to datetime fields since you will break sync if you fail to do so.
B - When using an SQL Insert/Update, etc.. Statement, always convert the typed value(s) to strings when refering to dateTiime. Make sure you are conforming to the proper format (CCYYMMDD HH:MM:SS) or you will break sync. TheDateToIso function will do it correctly.
--
rjl
[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): 6/18/2025 2:33:07 AM