Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Client script oldValue always empty

Brian Lancaster
Kilo Patron

I am writing an on Change script for the change module.   When I try and if (newValue == 'This' && oldValue == 'that') it is not working.   So I did a alert(newValue) along with an alert(oldValue) and oldValue is away returning as empty.   What might be causing oldValue not to return anything?   Just note that newValue is always returning what I expect it to.

13 REPLIES 13

Brian,



You can get previous value in Business Rule. I am not sure if that will be helpful with your requirement and fulfill your use case.


Brian Lancaster
Kilo Patron

I don't think that will work as I do not think these is a way to hide options or add options back in a drop down though a BR.


howellm
Kilo Expert

Same problem, trying to use it on Catalog Client Script.   I need to use oldValue to check what the previous option was so I can reset if needed options that I have removed from a drop down select box.   Example: If field 1 is x remove two options from field 2, if user changes mind and sets first field to y I need to allow those removed options to appear again in drop down field 2.




Marshall


I have the same problem. Did you find the solution ?

 

Its been so long.  I think I converted it to a business rule.  I don't work at the company anymore  so I don't have a way to look.  It appears that client script always returns null for oldValue so I'm not sure why they even have it.