What is wrong with the Client Script?.

Meera_P
Tera Expert

Hello,

I'm working on understanding how the Client Script functions, and I have developed a very simple code for state changes.  However, id didn't trigger. Could someone please help me identify what I might have done wrong?  

Thank you

 

Meera_P_0-1728496536925.png

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }

 if(newValue=='2'){
    alert("state changed to in progress");
}
   
}
4 REPLIES 4

PrashantLearnIT
Giga Sage

Hi @Meera_P 

 

Please correct the script on the highlighted one - change newValue == '2' to newValue == 2 it will work. Remove single course.

 

 

 

********************************************************************************************************
Please appreciate the efforts of community contributors by marking the appropriate response as the correct answer and helpful. This may help other community users to follow the correct solution in the future.

********************************************************************************************************
Cheers,
Prashant Kumar
ServiceNow Technical Architect


Community Profile LinkedIn YouTube Medium TopMate
********************************************************************************************************

Hi @PrashantLearnIT 

I have tried your suggestion before posting the question, but it did not work.

Meera_P_0-1728500852951.png

 

HI @Meera_P 

 

Its working for me, check screenshot below - 

PrashantLearnIT_0-1728501393883.png

this is the script 

 

PrashantLearnIT_1-1728501417047.png

 

 

********************************************************************************************************
Please appreciate the efforts of community contributors by marking the appropriate response as the correct answer and helpful. This may help other community users to follow the correct solution in the future.

********************************************************************************************************
Cheers,
Prashant Kumar
ServiceNow Technical Architect


Community Profile LinkedIn YouTube Medium TopMate
********************************************************************************************************

@PrashantLearnIT 

There might be something wrong with our development instance that caused this behavior.  I have reached out to SN support for assistance.  Thank you