Solved

CRM 4.0 Restrict Lookups to Account

Posted on 2010-11-19
9
1,211 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
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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

776 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