Solved

CRM 4.0 Restrict Lookups to Account

Posted on 2010-11-19
9
1,222 Views
Last Modified: 2013-12-12
When I create an order and click the Customer lookup, I want only Accounts to appear as an option. I have tried the script below but it messes up the Search function of the Customer lookup.  Is there a way I can change the script or another way to restrict the Customer lookup under Order to Accounts only?

The script below is the Onload Event of the Order entity.

Thanks
crmForm.customerid.lookuptypes = 1;

Open in new window

0
Comment
Question by:apollo7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 5

Expert Comment

by:HighlanderX
ID: 34176425
What is it doing to the Search function?

Maybe nothing, but the previous code i've seen has used .all


crmForm.all.customerid.lookuptypes=1;

Open in new window

0
 
LVL 1

Author Comment

by:apollo7
ID: 34176469
Here is what happens:

If I type a customer number in the lookup field, it does not work - gives me an error

If I then search, I can find it but when it comes back, the customerid is not recognized

I will try the script above, may just be the missing "all"

Thanks
0
 
LVL 1

Author Comment

by:apollo7
ID: 34176536
Tried the script with "all" included - same result.

The error message I get when I type in the customer number is: "error when trying to resolve the typed in address. Try using the Seach function"

After typing in, however, the Search function then does not work (brings back the customer id but only partially populates the customer id field)

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:mshogren
ID: 34199891
Try something like the following:

var customer = crmForm.all.customerid;
customer.lookuptypes = "1";
customer.lookuptypenames = "contact:1";
customer.lookuptypeIcons = "/_imgs/ico_16_1.gif";
customer.defaulttype = "1";
0
 
LVL 10

Expert Comment

by:Jeff Wight
ID: 34199912
Try this instead:

crmForm.all.customerid.setAttribute("lookuptypes", "1");
0
 
LVL 15

Accepted Solution

by:
mshogren earned 500 total points
ID: 34199989
Sorry mine should have read

Try something like the following:

var customer = crmForm.all.customerid;
customer.lookuptypes = "1";
customer.lookuptypenames = "account:1";
customer.lookuptypeIcons = "/_imgs/ico_16_1.gif";
customer.defaulttype = "1";
0
 
LVL 1

Author Closing Comment

by:apollo7
ID: 34200741
Thanks, worked perfectly first time.
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Invest in your employees with these five simple steps to improve employee engagement and retention.
Viewers will learn how to use the Hootsuite Dashboard.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question