Hide Recent Items from Dynamics 365 CRM Lookup form using Xrm.Utility.lookupObjects through JavaScript

  1. User property disableMru = true;
  2. You can refer below code

      selectProjectLayout: () => {

        var lookupOptions = {};

var _projectLayoutName = null;

var customFilter = ‘<filter type=”and”>’ +

‘<condition attribute=”cf_project” operator=”eq” value=”‘ + Operations.selectedProjectId + ‘”/>’ +

‘</filter>’;

lookupOptions.allowMultiSelect = false;

lookupOptions.defaultEntityType = “cf_tcmaplayout”;

lookupOptions.entityTypes = [“cf_tcmaplayout”];

        lookupOptions.disableMru = true;// used to hide recent items

try {

if (Operations.selectedProjectId !== null) {

lookupOptions.filters = [{ filterXml: customFilter }];

Xrm.Utility.lookupObjects(lookupOptions).then(

function (result) {

if (result !== undefined && result.length > 0) {

// your code

}

}

},

function (error) {

if (error != null) {

Xrm.Utility.alertDialog(error.message);

}

}

);

}

} catch (e) {

Xrm.Utility.alertDialog(e.message);

}

}


Share Story :