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!
|
|
Adding new fields to 'Add New Contact Account' form
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 |
|
|
|
Re: Adding new fields to 'Add New Contact Account' form
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.
|
|
|
|
Re: Adding new fields to 'Add New Contact Account' form
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. |
|
|
|
Re: Adding new fields to 'Add New Contact Account' form
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.
|
|
|
| |
|
Re: Adding new fields to 'Add New Contact Account' form
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. |
|
|
|
Re: Adding new fields to 'Add New Contact Account' form
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! |
|
|
|
Re: Adding new fields to 'Add New Contact Account' form
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 |
|
|
|