LookUp Filtering Using form Value By Javscript

Filtered LookUp  Using form Value By Javscript :-

Contact entity has the lookup of account entity. The Account lookup must show the related Email Accounts based on email of contact entity. Before entering the email value on contact entity, It will show all the accounts and once if he entered the email it have to show the only related email accounts.

Trigger the following function EmailPreFilterLookup()  on ONLOAD of form.

addPreSearch method will trigger when we click on the Account LookupFiled Icon 45


function EmailPreFilterLookup() {
 Xrm.Page.getControl("AccountLookupschemaname").addPreSearch(function () {
function addLookupFilter() {
 var email = Xrm.Page.getAttribute("emailaddress1").getValue();
 if (email != null) {
 fetchXml = "<filter type='and'><condition attribute='emailaddress1' operator='eq' value='" + email + "' /></filter>";


Enjoy 🙂


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s