Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

Filterd LookUp using Javascript

$
0
0

HI,

I have one Email field and contact lookup in concern form. i need to filter the lookup based on the email.i am using below code. but the values are not coming in the lookup and if we click on the lookup it is giving error saying that contact system admin. on change of email i am refreshing the form and i am calling this function in onLoad. can any one please help on this.

function onLoad() {

Xrm.Page.getControl("sandeep_customername").addPreSearch(function () {
addLookupFilter();
});
}

function addLookupFilter() {
try {
var email = Xrm.Page.getAttribute("sandeep_emailid").getValue();
if (email != null) {
var filter = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"
+ "<entity name='account'>"
+ "<attribute name='name'/>"
+ "<attribute name='telephone1'/>"
+ "<attribute name='contactid'/>"
+ "<attribute name='emailaddress1'/>"
+ "<order descending='false' attribute='name'/>"
+ "<filter type='and'>"
+ "<condition attribute='sandeep_emailid' operator='like' value='" + email + "'/>"
+ "</filter></entity></fetch>";
Xrm.Page.getControl("sandeep_customername").addCustomFilter(filter);

}
}
catch (ex) {
throw ex
}

}

Thanks.


Viewing all articles
Browse latest Browse all 79901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>