Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, November 26, 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!
 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: Adding new fields to 'Add New Contact Account' form
Darren Savery
Posts: 51
 
Adding new fields to 'Add New Contact Account' formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 01 Dec 06 5:43 AM
fiogf49gjkf0d
Hi,

I have a 1:1 lookup extension table (LOGITECHACCOUNTEXT) that holds additional information linked the the account table. On the 'Add New Contact Account' form, I have added extra fields so a user can populate this additional table when creating a new contact/account. I have added the following code to the script to get it to populate the database fields but it doesn't work:

Sub SaveAccountExtensionInfo
Dim objRS
Dim strSQL

Set objRS = objSLXDB.GetNewRecordSet
'Creates the structure of the recordSet.
strSQL = "Select * from LOGITECHACCOUNTEXT where 1=2" 'DNL
objRS.Open strSQL, objSLXDB.Connection

'Adding the record To the database.
objRS.AddNew
objRS.Fields("ACCOUNTID").Value = CheckForNull(mLastAccID) 'DNL
objRS.Fields("CREATEUSER").Value = Application.BasicFunctions.CurrentUserID 'DNL
objRS.Fields("CREATEDATE").Value = Now 'DNL
objRS.Fields("MODIFYUSER").Value = Application.BasicFunctions.CurrentUserID 'DNL
objRS.Fields("MODIFYDATE").Value = Now 'DNL
objRS.Fields("TECHNOLOGYGROUP").Value = pckTechGroup.Text
objRS.Fields("SOURCE").Value = lueAccLeadSource.Text
objRS.Fields("ACCOUNT_NO").Value = txtAccountNo.Text
objRS.Fields("COMPANYTYPE").Value = pckCompanyType.Text

objRS.Update
objRS.Close
Set objRS = Nothing

End Sub

Can you anyone work out what i'm doing wrong?

Thanks,

Darren
[Reply][Quote]
Frank Chaffin
Posts: 475
 
Re: Adding new fields to 'Add New Contact Account' formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 01 Dec 06 1:12 PM
fiogf49gjkf0d
Make sure that none of the source values being passed into the recordset are NULL. As I recall the SalesLogix code does a call to checkfornull on every value.

Make sure your code is being called after mLastAccID is seeded with the correct value.

[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Adding new fields to 'Add New Contact Account' formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Dec 06 6:05 AM
fiogf49gjkf0d
The above is an exact copy of the InsertNewAccount so, therefore, should work - however, I have to ask the obvious - you have put a call in after the Sub InsertNewAccount - otherwise your routine is never called.
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Adding new fields to 'Add New Contact Account' formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Dec 06 3:49 AM
fiogf49gjkf0d
Darren:

The code itself looks OK, so you probably need to check wether it is being triggered or not, the scope of objSLXDB, the values of your controls.

I would do several things to test this:
a) Check the Scope of the objSLXDB object
b) Add a msgbox to show that your function is indeed being called
c) Add a stop statement to the VB Script right after the message box and before creating the Recordset
d) Set your SLX to Debug on Error
e) Execute the code. After the message box SalesLogix your system will prompt you for a choice of debugger and you will be able to step through the code line by line. Check the values of each control. If you have a potential for nulls, add & "" after reading the Text to ensure that you are passing in a blank string rather than a null.

[Reply][Quote]
Darren Savery
Posts: 51
 
Re: Adding new fields to 'Add New Contact Account' formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Dec 06 4:17 AM
fiogf49gjkf0d
Im using the call:

If len(mLastAccID) > 1 Then SaveAccountExtensionInfo

within the InsertNewAccount routine. I hope that's correct?

Darren
[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Adding new fields to 'Add New Contact Account' formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 04 Dec 06 4:21 AM
fiogf49gjkf0d
Yes, but where is this being called *from* ?
I would do as Paul say - execute a stop at the point you think it's being called - and if you don't get a message box/stop then it's not being called (hence, why it's not saving)

Essentially, look for where SLX is saving the data and in the InsertAccount and InsertAccountOnly routine and add your call (don't bother with the >1 bit - no point) straight after that.
[Reply][Quote]
Darren Savery
Posts: 51
 
Re: Adding new fields to 'Add New Contact Account' formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Dec 06 10:58 AM
fiogf49gjkf0d
Hi guys,

Sorry for the delay in trying out your answers!

From your advice, I have managed to get the error message to appear if the field is blank. However, when you click 'OK' in the dialog box, it just goes ahead and saves the form. Any ideas how I can stop it saving and closing and instead return me to the form to edit it further?

Thanks!
[Reply][Quote]
Ron Buchanan
Posts: 72
 
Re: Adding new fields to 'Add New Contact Account' formYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Dec 06 2:19 PM
fiogf49gjkf0d
The way I handle this is to change the ModalResult on the form button to mrNONE, then execute selected snippet OnClick, and if successful, change the ModalResult of the OK button.

--Ron
[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/26/2024 10:51:22 PM