CRM Blog

Adding A Filtered Lookup In CRM

by Danny Varghese 02.03.09

Another common question I see in blogs from users are is there a way to add filtered lookups?  That is only allow users to "lookup" certain records that related to that particular one.  Here's a real life example:

 

Say you have an account that has a 1:N parental relationship with entity A.  Now let's say there's another entity B that has N:1 referential relationships with both account, and entity A.  There is a way on entity B so that after you select, on the lookup, a record of the account you want to relate to it, to filter the second lookup of entity A to only those related to the account you just selected.  i.e.

 

Parental Relationship

Account --> Entity A

 

Referential Relationship

Entity B -- Account

Entity B -- Entity A

 

With simple JavaScript, when a user selects the lookup value for the account, the lookup for Entity A can be filtered to point to only those entity A's that are related to the account you just chose.  Here's the code to place on the form of Entity B:

 

crmForm.all.<lookup field for entity A>.additionalparams = 'search=' + encodeURIComponent(crmForm.all.<lookup field for account>.DataValue[0].name);

 

That's it!  Simple, yet effective.

Filed under:

Comments

# Filter Lookup Records returned by Add Existing Button | keyongtech said on February 16, 2009 04:09 PM:

Pingback from  Filter Lookup Records returned by Add Existing Button | keyongtech

# pmdci said on February 18, 2009 12:49 AM:

Nice one. I would if it would work in a similar scenario?

Account has two new entities with N:1 relationship:

1. Country (has just one attribute: Country Name)

2. Region (one attribute: Region Name, plus a N:1 relationship with Country)

Now back in the Account form, when selecting a region, its lookup form should ONLY display the regions related to the selected Country.

# B3500 Discounts Quality, Pb350 Parts Discount Vacuum Backpack said on May 21, 2010 04:49 AM:

Pingback from  B3500 Discounts Quality, Pb350 Parts Discount Vacuum Backpack

# 1993 Lexus Gs300 Accessories Aftermarket Parts, 2000 Chrysler 300m Exhaust said on May 21, 2010 05:49 AM:

Pingback from  1993 Lexus Gs300 Accessories Aftermarket Parts, 2000 Chrysler 300m Exhaust

# 2007 Jeep Compass Photos, Compass Headlight Bulb Size Automotive said on May 21, 2010 02:39 PM:

Pingback from  2007 Jeep Compass Photos, Compass Headlight Bulb Size Automotive

# E 200 Econoline Radiator Ford Aerostar, Aerostar Sell Classified said on May 21, 2010 04:23 PM:

Pingback from  E 200 Econoline Radiator Ford Aerostar, Aerostar Sell Classified

# Disposable Wine Glasses Sams Club, 2010 Cadillac Cts Sport Wagon Launch Cargo Management System said on May 21, 2010 04:47 PM:

Pingback from  Disposable Wine Glasses Sams Club, 2010 Cadillac Cts Sport Wagon Launch Cargo Management System

# New Lexus Gs350 Specs 2gr Fse, Gs350 Blower Auto Parts said on May 21, 2010 06:32 PM:

Pingback from  New Lexus Gs350 Specs 2gr Fse, Gs350 Blower Auto Parts

# Aftermarket Salvage Yards Dodge D150 Pickup, 2003 Gmc Sierra 1500 Hd Slt Four Wheel Steering said on May 21, 2010 08:46 PM:

Pingback from  Aftermarket Salvage Yards Dodge D150 Pickup, 2003 Gmc Sierra 1500 Hd Slt Four Wheel Steering

# Lancer Company, Lancer Design Companies In Singapore said on May 21, 2010 11:44 PM:

Pingback from  Lancer Company, Lancer Design Companies In Singapore

# Modifiyeli Wolksvagen Transporter, Vw Transporter Scrap said on May 22, 2010 05:01 AM:

Pingback from  Modifiyeli Wolksvagen Transporter, Vw Transporter Scrap

# K24 K2500 Suburban Headlight Salvage Yards Kia Sephia, Optima Air Filter Kia Sephia said on May 22, 2010 05:20 AM:

Pingback from  K24 K2500 Suburban Headlight Salvage Yards Kia Sephia, Optima Air Filter Kia Sephia

# 262 Hid System, 262 Parts Gws Wing Loading said on May 22, 2010 07:25 AM:

Pingback from  262 Hid System, 262 Parts Gws Wing Loading

# Pulsar Chronograph Swarovski Crystal Mens Watch, Nx Parts 1987 Nissan Pulsar Fuel Injector Shock Absorber said on May 22, 2010 05:51 PM:

Pingback from  Pulsar Chronograph Swarovski Crystal Mens Watch, Nx Parts 1987 Nissan Pulsar Fuel Injector Shock Absorber

# Red Fox Cubs For Sale, R20 Fox Promotion said on May 22, 2010 08:32 PM:

Pingback from  Red Fox Cubs For Sale, R20 Fox Promotion

# Sale 1995 Lebaron Chrysler Imperial, 62 Imperial Convertible said on May 22, 2010 08:50 PM:

Pingback from  Sale 1995 Lebaron Chrysler Imperial, 62 Imperial Convertible

# Find New Jeep Compass, Used Grand Wagoneer For Sale Comanche Jeep Compass said on May 22, 2010 11:14 PM:

Pingback from  Find New Jeep Compass, Used Grand Wagoneer For Sale Comanche Jeep Compass

# Jeep Wrangler Neoprene Seat Covers Floor Mats, Eagle Cheats - 283.dlmreza.net said on May 23, 2010 02:19 AM:

Pingback from  Jeep Wrangler Neoprene Seat Covers Floor Mats, Eagle Cheats - 283.dlmreza.net

# 1996 Mercedes Benz C280 Sport, Models Condition Used Year Color 1999 Mercedes Benz C280 - 45.renters.ws said on May 23, 2010 03:35 AM:

Pingback from  1996 Mercedes Benz C280 Sport, Models Condition Used Year Color 1999 Mercedes Benz C280 - 45.renters.ws

# Glk Part Mercedes 450sl, Mercedes Benz 450sl Replacement Eastern Catalytic Converter Brake Disc - 204.tvshowzone.com said on May 24, 2010 08:32 AM:

Pingback from  Glk Part Mercedes 450sl, Mercedes Benz 450sl Replacement Eastern Catalytic Converter Brake Disc - 204.tvshowzone.com

# Fiesta St Body Kit, Fiesta Parts Gas Grill Repair - 129.jordanbrandallamerican.com said on May 24, 2010 09:35 AM:

Pingback from  Fiesta St Body Kit, Fiesta Parts Gas Grill Repair - 129.jordanbrandallamerican.com

# Mdx Headlight Promo Dealer, 2006 Sale 2009 Acura Mdx - 92.an74.com said on May 24, 2010 01:09 PM:

Pingback from  Mdx Headlight Promo Dealer, 2006 Sale 2009 Acura Mdx - 92.an74.com

# Ip35 P3500 Van Factory Following, C3500 Substitute Intended - 223.renters.ws said on May 24, 2010 03:42 PM:

Pingback from  Ip35 P3500 Van Factory Following, C3500 Substitute Intended - 223.renters.ws

# C35 C3500 Auto Boiler S10 Blazer, C40 C3500 1500 Aftermarket Silverado 2500 - 379.an74.com said on May 24, 2010 05:15 PM:

Pingback from  C35 C3500 Auto Boiler S10 Blazer, C40 C3500 1500 Aftermarket Silverado 2500 - 379.an74.com

# 740il Part Search Youtube, 1997 Bmw 740i Specs Windshield Wipers - 341.zapstreaming.com said on May 25, 2010 03:59 AM:

Pingback from  740il Part Search Youtube, 1997 Bmw 740i Specs Windshield Wipers - 341.zapstreaming.com

# 300sdl Asscher, 300sd Factory Installed - 475.defutbolazo.com said on May 25, 2010 06:34 AM:

Pingback from  300sdl Asscher, 300sd Factory Installed - 475.defutbolazo.com

# 1995 Ford Aspire Wiki, As5532 5535 Acer Aspire Laptop - 18.tgrconversions.com said on May 25, 2010 06:55 AM:

Pingback from  1995 Ford Aspire Wiki, As5532 5535 Acer Aspire Laptop - 18.tgrconversions.com

# Lockout Relay Wiring Diagram, Saturn Relay Headlight Housing - 71.akemet.com said on May 25, 2010 11:05 PM:

Pingback from  Lockout Relay Wiring Diagram, Saturn Relay Headlight Housing - 71.akemet.com

# 1993 - 1983 @ Radiator Shop 1969 Ford Torino, 1972 Gran Torino Sport Diecast Model - 8.tvshowzone.com said on May 31, 2010 04:07 PM:

Pingback from  1993 - 1983 @ Radiator Shop 1969 Ford Torino, 1972 Gran Torino Sport Diecast Model - 8.tvshowzone.com

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Security Check
Please answer the simple math problem below.

(required)