Solved

CRM 4.0 Restrict Lookups to Account

Posted on 2010-11-19
9
1,205 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 15

Expert Comment

by:mshogren
Comment Utility
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
Comment Utility
Try this instead:

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

Accepted Solution

by:
mshogren earned 500 total points
Comment Utility
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
Comment Utility
Thanks, worked perfectly first time.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

In our personal lives, we have well-designed consumer apps to delight us and make even the most complex transactions simple. Many enterprise applications, however, are a bit behind the times. For an enterprise app to be successful in today's tech wo…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now