Posts

Showing posts with the label FilterLookup in CRM 2011 with Javascript

how to Filter lookup in CRM 2011 by javascript in Client Side.

You can set any lookup with custom view in client. Here is a simple javascript code build dfor CRM 2011.This code run in onLoad of  Response  Custom entity. relation of the entities EntA 1---N EntB 1---N EntC 1-- N EntD for the sample. Filter rule is; Lookup gets only selected EntAs for the EntD function onLoad() { //filter questions for the current EntC var EntCLookup = Xrm.Page.getAttribute("field of the EntityReference of EntC").getValue(); if (EntCLookup != null) { var EntCId = EntCLookup[0].id; var viewId = "{8F03FB3E-0EFF-4417-B704-80CE1711B8D2}";/static guid id.you can obtain by Visual Studio tool var entityName = "EntA"; var viewDisplayName = "EntA Filtered View by EntC"; var fetchXML = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>" + "<entity name='EntA'>&q