Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

Simple jscript code not firing correctly

$
0
0

Maybe I have been staring at this too long, but this is a simple if, else if statement.  Change the value of field 1, and auto-set fields 2 and 3.  When changing field 1, no matter what value I select, fields 2 & 3 show the value for the Field 1 value 1 no matter what field 2 & 3 values are supposed to be.

Field 1 Value = Auto; Field 2 Value = 500;  Field 3= >250000;

Field 1 Value = Govt; Field 2 Value = >5000; Field 3 = >1000000; but returns Field 2 Value = 500;  Field 3= >250000; the values for field 1 Value auto.

Here is the code:

function BusinessType_onchange()
{
var BusType = Xrm.Page.getAttribute("esui_industry").getValue();
var Gas = Xrm.Page.getAttribute("esui_gasload");
var Elec = Xrm.Page.getAttribute("esui_electricload")

if(BusType = 661760000)
   {
      Gas.setValue(661760001);
      Elec.setValue(661760000);
   }
else if(BusType = 661760001)
   { 
      Gas.setValue(661760002);
      Elec.setValue(661760000);
   }
else if(BusType = 661760002)
   { 
      Gas.setValue(661760000);
   Elec.setValue(661760000);
   }   
else if(BusType = 661760003)
   { 
     Gas.setValue(661760001);
   Elec.setValue(661760003);
   }
else if(BusType = 661760004)
   { 
      Gas.setValue(661760000);
   Elec.setValue(661760000);
   }      
else if(BusType = 661760005)
   { 
      Gas.setValue(661760001);
   Elec.setValue(661760000);
   }   
else if(BusType = 661760006)
   { 
      Gas.setValue(661760001);
   Elec.setValue(661760000);
   }   
else if(BusType = 661760007)
   { 
      Gas.setValue(661760000);
   Elec.setValue(661760000);
   }      
else if(BusType = 661760008)
   { 
      Gas.setValue(661760000);
   Elec.setValue(661760000);
   }      
else if(BusType = 661760009)
   { 
      Gas.setValue(661760001);
   Elec.setValue(661760000);
   }      
else if(BusType = 661760010)
   { 
      Gas.setValue(661760002);
   Elec.setValue(661760002);
   }      
else if(BusType = 661760011)
   { 
      Gas.setValue(661760001);
   Elec.setValue(661760002);
   }      
else if(BusType = 661760012)
   { 
      Gas.setValue(661760002);
   Elec.setValue(661760003);
   }      
else if(BusType = 661760013)
   { 
      Gas.setValue(661760001);
   Elec.setValue(661760001);
   }     
else if(BusType = 661760014)
   { 
      Gas.setValue(661760000);
   Elec.setValue(661760000);
   }     
else if(BusType = 661760015)
   { 
      Gas.setValue(661760002);
   Elec.setValue(661760001);
   }     
else if(BusType = 661760016)
   { 
      Gas.setValue(661760000);
   Elec.setValue(661760000);
   }     
else if(BusType = 661760017)
   { 
      Gas.setValue(661760001);
   Elec.setValue(661760000);
   }        
else if(BusType = 661760018)
   { 
      Gas.setValue(661760002);
   Elec.setValue(661760001);
   }        
else if(BusType = 661760019)
   { 
      Gas.setValue(661760001);
   Elec.setValue(661760000);
   }        
else if(BusType = 661760020)
   { 
      Gas.setValue(661760001);
   Elec.setValue(661760000);
   }        
else if(BusType = 661760021)
   { 
      Gas.setValue(661760000);
   Elec.setValue(661760000);
   }     
else if(BusType = 661760022)
   { 
      Gas.setValue(661760001);
   Elec.setValue(661760002);
   }     
else if(BusType = 661760023)
   { 
      Gas.setValue(661760002);
   Elec.setValue(661760001);
   }     
else if(BusType = 661760024)
   { 
      Gas.setValue(661760000);
   Elec.setValue(661760000);
   }     
else if(BusType = 661760025)
   { 
      Gas.setValue(661760002);
   Elec.setValue(661760000);
   }  
else if(BusType = 661760026)
   { 
      Gas.setValue(661760003);
   Elec.setValue(661760003);
   }  
}

No error messages, just wrong value.  Has got to be something simple.  Any help is appreciated.


Ken Compter


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>