locked
UnCheck Filter by Related Employer in Crm 2011 Custom lookup RRS feed

  • Question

  • Hi,

    I have a custom lookup  and I define fetch xml and Xml layout and I disabled The view picker.

    See the below code. It works perfect

    Xrm.Page.getControl("my_attribute").addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);

    document.getElementById("my_attribute").setAttribute("disableViewPicker", "1");

    My question is there any way to programatically remove the checkmark from the

    "Filter by related employer" checkbox on the lookup view?

    Thanks,

    Maryam

     

    Tuesday, February 4, 2014 7:04 PM

All replies

  • Hi

    Go to Form Customization --> Open Lookup settings.

    Uncheck the checbox "Only Show Records where". This is quickest and supported way of doing it

    Is there some requirement that you have to do it only programmatically ?

    Tuesday, February 4, 2014 8:33 PM
  • Well yes as you menetioned I know about the checkbox and currently I did the same thing.

    But I want to have "Only Show Records where" checked so if for any reason the javascript to build the custom lookup is failed it stills return the correct records.

    My custom lookup dispalys all the related records + a dummy number. So if for some reaon the javascripts fails in worse case senario I would not have my dummy account number in the list.

    I wonder if there is a way?

    Thanks,

    Maryam

    Tuesday, February 4, 2014 11:33 PM
  • Hi,

    you can use :

    document.getElementById("my_attribute").setAttribute("dependantattributename", null);

    and if you want to set back the filter again you can define the value with this code :

    document.getElementById("my_attribute").setAttribute("dependantattributename", "my_entity.my_lookupattribute");

    Thursday, April 17, 2014 7:45 AM