LookupEdit controls 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.

Stay tuned to slxdeveloper.com for a more in-depth article on the subject.

ABOUT THE AUTHOR

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

1 Comment

  1. I’m going to have to disagree with you there since I have this functionality working(Active Form) in one of my systems currently(v6.1) unless this is a fluke!

    I’m also a little saddend to find out you’re closing down the shop but find solace in that you’ll be continuing your efforts through slxdeveloper.com.

    Reply

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!