Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Show/Hide optionset values....

$
0
0

Hello,

Here is my scenario:

I have Field A that is a drop down, Field B is a lookup and Field C is a drop down.  Some how I need that when Field A is Football and Field B is Stadium and Field C is Yes, that then Field D shows only certain items in the optionset list..

function SportTypeOnChange()
 {
 var Sport = Xrm.Page.getAttribute("nhs_Sport").getText();
 var Place = Xrm.Page.getAttribute("nhs_place").getText();
 var Startup = Xrm.Page.getAttribute("nhs_startup").getText();
 
  if (Sport == null || Sport =='undefined' || Sport =='')
   {
    Xrm.Page.getControl("nhs_callcentertype").clearOptions();
   }
  else if (Sport != null && Sport != 'undefined' && Sport !='')
   {
   var SportText = Xrm.Page.getAttribute("nhs_Sport").getSelectedOption().text;
   var PlaceText = Xrm.Page.getAttribute("nhs_place").getSelectedOption().text;
   var StartupText = Xrm.Page.getAttribute("nhs_startup").getSelectedOption().text;
   
    if (Sport == "Football" && Place == "Stadium" && Startup == "No")
     {
      Xrm.Page.getControl("nhs_callcentertype").removeOption(127130000);
      Xrm.Page.getControl("nhs_callcentertype").removeOption(127130004);
      Xrm.Page.getControl("nhs_callcentertype").removeOption(127130005);
     }
  else if (Sport == "Football" && Place == "Stadium" && Startup == "Yes")
     {
      Xrm.Page.getControl("nhs_callcentertype").addOption({value: 127130000, text: 'NFL'});
      Xrm.Page.getControl("nhs_callcentertype").addOption({value: 127130001, text: 'Soccer'});
      Xrm.Page.getControl("nhs_callcentertype").addOption({value: 127130002, text: 'Golf'});
      Xrm.Page.getControl("nhs_callcentertype").addOption({value: 127130003, text: 'NHL'});
      Xrm.Page.getControl("nhs_callcentertype").addOption({value: 127130004, text: 'NBA'});
     }
   }
 }

Can this be done, if so how?  I am getting an getText error


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images