Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, August 23, 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: Can't get lookup field to work properly
Darren Savery
Posts: 51
 
Can't get lookup field to work properlyYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 16 Apr 08 7:20 AM
Hi,

I'm having problems with getting a custom lookup field to work.

I have create a new table and main view called 'RAN'. I have added a tab to it called 'RAN contacts'. I want to create a lookup that will lookup the contact table and return the contactID to the 'RAN Contacts' table. All I can get the lookup to work, but only if the lookup criteria is the same as the data being entered into the table i.e. if I search on ContactID, it returns ContactID. What I really want is to lookup the contact's lastname and populate the table with their ContactID. Here are the values I am using:

lookup : Contact:Lastname
LookupID: RAN_Contact:ContactID
LookupMainTable: Contact
Lookup Mode: lmTable
Text: RAN_Contact:ContactID

What am I doing wrong?
[Reply][Quote]
Brian Thews
Posts: 34
 
Re: Can't get lookup field to work properlyYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 16 Apr 08 7:34 AM
I think that is just the way it works. I am on 7.0.1, and the only way I have been able to get it to work (even working with my Vendor) is to save the contact id to the table.
Create a hidden text box that stores the value of the id field from the database.
Then I have an event in the onChange of the form that takes that id and does a lookup on the contact table to get me the name, and then I set the text value of the lookup field to the contact name.
here is an example:


Sub AXFormChange(sender)
Dim strContactID

'Populate the contact name
strContactID = txtContactID.Text
SetContactName(strContactID)
end sub


sub SetContactName(contactId)
Dim objRS
Dim objSLXDB
Dim strSQL
Dim ContactName

If (contactId <> "") Then
Set objSLXDB = New SLX_DB
Set objRS = objSLXDB.GetNewRecordSet
strSQL = "Select CONTACTNAME FROM C_CONTACT WHERE C_CONTACTID = '" & contactId & "'"
objRS.Open strSQL, objSLXDB.Connection

If not (objRS.EOF Or objRS.BOF) then
ContactName = objRS.Fields("CONTACTNAME").value
End If

objRS.Close
Set objRS = Nothing
End If

lveRNAContact.Text = ContactName
end sub



Hopefully someone else will let us know if there is a better way - because this always seemed absurd to me.
Brian
[Reply][Quote]
Darren Savery
Posts: 51
 
Re: Can't get lookup field to work properlyYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 16 Apr 08 7:38 AM
Hi Brian,

I'll give it a go.

I'm far from an expert...hell, i'm not even a developer! I thought it would have been straightforward to look up one value and return another. All I want to do is look up a contact by their name and return their ContactID. *sniff sniff*
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Can't get lookup field to work properlyYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 16 Apr 08 1:18 PM
Use a LookupEdit Control.....the ID field is returned in the LookupID property.....and the Contact's Name is returned in the .TEXT property.

Now that you have the ID value of the user selected contact, script away. * belch belch*
[Reply][Quote]
Darren Savery
Posts: 51
 
Re: Can't get lookup field to work properlyYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 17 Apr 08 5:46 AM
Hi RJ,

Thanks for the help. I've got this working now.

I would now like to be able to double click on a datagrid row ('grdContacts') and for it to take me to their contact detail screen. Do you have any idea how I can do this? I tried the following code but nothing happens when I click on the row:

'Including Script - System:SLX_Common
'Including Script - System:SLX Activity Support
'Including Script - System:SLX Database Support
option explicit

Sub CallContactDetailView
OpenMainViewFromGridCrntID grdContacts, "CONTACTID", "System:Contact Details", 1, True 'DNL
End Sub

Sub grdContactsDblClick(Sender)
CallContactDetailView
End Sub


Thanks!
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Can't get lookup field to work properlyYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Apr 08 8:57 AM
Sub returnfromdoubleclick
DIM CID
CID = "" & Gridname.GetCurrentField("CONTACTID")
If CID > "" THEN Application.basicfunctions.setcurrentcontactID CID
END SUB
[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/23/2025 10:26:34 AM