Hi,
I am opening a lookup dialog using “Xrm.Utility.lookupObjects” method added filter for the same using below code. This works fine when CRM accessed using browser but it’s not working for UCI. It is not throwing any error but it did not apply filter. It shown all records.
Below is code that we are using.
function showContactLookupDialog() {
try {
var fetch = "<filter type='and'><condition attribute='lastname' operator='like' value='%Brown%' /></filter>";
var encodedURL = encodeURIComponent(fetch).replace(/'/g, "%22");
var lookupParameters = {};
//specify the list of entity types to be displayed in lookup dialog
lookupParameters.entityTypes = ["contact"];
//Sepecify the default entityType need to be displayed
lookupParameters.defaultEntityType = "contact";
//Default view need to be displayed
lookupParameters.defaultViewId = "{00000000-0000-0000-00AA-000010001004}";
//allow multiple selection or not
lookupParameters.allowMultiSelect = false;
//list multiple views available on lookup dialog
lookupParameters.viewIds = ["{0D5D377B-5E7C-47B5-BAB1-A5CB8B4AC105}", "{A2D479C5-53E3-4C69-ADDD-802327E67A0D}"];
lookupParameters.customFilters = [encodedURL];
lookupParameters.customFilterTypes = ["contact"];
Xrm.Utility.lookupObjects(lookupParameters).then(DisplaySelectedContact, null);
} catch (e) {
Xrm.Utility.alertDialog(e.message);
}
}
Can anyone face such type of issue and have solution for it.
Thanks!
Balasaheb