How do I create a SalesLogix Lookup that has multiple restrictive values?

Question:

We currently have a lookup that looks at a field (myField) in a table (C_myTable), the lookup uses a pick list (Company Names)

 

The Main Table: ACCOUNT

Search Field: ACCOUNT.myTable.myField

ID Field: ACCOUNT.Accountid

Name Field: ACCOUNT.Account

Pick List: Company Names

Field Type: String

 

But we want to change it so it only displays records whose (myField_Status) is ACTIVE. How can I do this from the Edit Lookup form?

 

Answer:

‘HowTo – LookupEdit with Multiple Restrictions
A question that surfaces fairly often deals with LookupEdit controls and how to do more with the LookupRestriction properties, such as add multiple conditions to the restriction. Although it is undocumented, you can do that with the existing LookupEdit – you just have to put things in the wrong place. Let’s say you want to add a restriction to a LookupEdit for all contacts with an areacode of “623” AND that have a title of “Developer”.
LookupRestrictField = “WORKPHONE”
LookupRestrictOp = ” LIKE ‘623%’ AND TITLE = ‘Developer’ AND “1” = “
LookupRestrictValue = “1”
Or you could do it like this:
LookupRestrictField = “CONTACTID”
LookupRestrictOp = ” IN (SELECT CONTACTID FROM CONTACT WHERE WORKPHONE LIKE ‘623%’ ” & _                   
                         “AND TITLE = ‘Developer’) AND “1” = “
LookupRestrictValue = “1”
A few things to point out, make sure you notice the extra space at the start of the operator (ie: before “IN” or “LIKE” etc). This is needed because when the final query is constructed it just appends the three values together without spaces (so you’d get something like “CONTACTIDIN…” without the space). Also, the reason why you have to put all that in the RestrictOp property is because when the final query is constructed the RestrictValue gets enclosed in single-quotes. That is also the reason for the AND “1” = at the end.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!