lundi 15 mars 2021

D365 Custom JS Web Resource - ReferenceError: Web resource method does not exist: preFilterLookup

we have tried to upload a small JS web resource to filter a specific lookup field, but I keep receiving an error: ReferenceError: Web resource method does not exist: preFilterLookup

Here is the code that we are trying to use:

function preFilterLookup() {    Xrm.Page.getControl("new_opportunitytypelookup").addPreSearch(function () {
     addLookupFilter();

   });
}
function addLookupFilter() {
    var oppScope = Xrm.Page.getAttribute("new_opportunityscope").getText();

    if (oppScope.getText()=="BMS Operational Outsourcing") {
        fetchXml = "<filter type="and">
      <condition attribute="cr2f5_opportunitytypeid" operator="in">
        <value uiname="aaS Offering" uitype="cr2f5_opportunitytype">{42403355-925B-EB11-A812-000D3A8C6500}</value>
        <value uiname="Operational Outsourcing" uitype="cr2f5_opportunitytype">{DF7CC32A-925B-EB11-A812-000D3A8C6500}</value>
      </condition>
    </filter>";            Xrm.Page.getControl("new_opportunitytypelookup").addCustomFilter(fetchXml);
    }
}

I initially thought we even have the correct "On Change" event setup for our specific field too with the method defined Opportunity Scope - On Change Event




Aucun commentaire:

Enregistrer un commentaire