locked
Script Error on my Javascript in Dynamics RRS feed

  • Question

  • I need help determining the error on my .js for a multiselect field in Dynamics 365. 

    function GetMultiSelectOptions(executionContext)  {

         var formContext = executionContext.getFormContext();
       var optionField = formContext.getAttribute("utc_clientdescription").getSelectedOption();
       
       if (optionField !== null && optionField.length >0) {
             
    for (var i = 0; i < optionField.length; i++)  {

       if (optionField[i].text = "Advisor" || "Advisor Partner" || "Advisor Partner Assistant") {
    formContext.getControl("utc_annualsurvey").setVisible(false);
    formContext.getControl("utc_plansponsornewsletter").setVisible(false);
    formContext.getControl("utc_blogsubscribergeneraltopics").setVisible(false);
    formContext.getControl("utc_upanniversarymailing").setVisible(false);
    formContext.getControl("utc_nationalemployeebenefitdaygift").setVisible(false);
    formContext.getControl("salutation").setVisible(false);
        }  


       if (optionField[i].text = "Plan Sponsor") {
    formContext.getControl("utc_companynamelookup").setVisible(false);
    formContext.getControl("utc_brokerdealerlookup2").setVisible(false);
    formContext.getControl("utc_allowmanagedrolloveraccount").setVisible(false);
    formContext.getControl("utc_advisorfocusgroup").setVisible(false);
    formContext.getControl("utc_advisorchristmasgift").setVisible(false);
    formContext.getControl("utc_alcoholandcaffeinerestriction").setVisible(false);
    formContext.getControl("utc_cpaappreciationday").setVisible(false);
    formContext.getControl("utc_blogsubscriberfinancialprofessional").setVisible(false);
    formContext.getControl("utc_advisornewsletterrecipient").setVisible(false);
    formContext.getControl("utc_advisorquarterlywebinar").setVisible(false);
    formContext.getControl("utc_advisortopicwebinar").setVisible(false);
    formContext.getControl("utc_opencase").setVisible(false);
        }

     //           alert(optionField[i].text);
     
          if (optionField[i].text = "Accountant" || "Attorney" || "BD/RIA Home Office Contact" || "Industry Contact" || "RPCG Prospect" || "RPCG- Misc" || "TPA" || "Vendor" || "WM Client" || "WM - COI") {
    formContext.getControl("utc_class").setVisible(false);
    formContext.getControl("utc_brokerdealerlookup2").setVisible(false);
    formContext.getControl("utc_allowmanagedrolloveraccount").setVisible(false);
    formContext.getControl("utc_advisornewsletterrecipient").setVisible(false);
    formContext.getControl("utc_advisorquarterlywebinar").setVisible(false);
    formContext.getControl("utc_advisortopicwebinar").setVisible(false);
    formContext.getControl("utc_plansponsornewsletter").setVisible(false);
    }
       }
       }
    }

    Tuesday, February 4, 2020 2:15 PM

Answers