Setting the variable to oldValue in onchange client script

jparman
Tera Guru

Hi!

 

I have a requirement to check if the unit cost variable in a variable set is numeric.

jparman_0-1698306799756.png

 

If it is none numeric, it will return to its previous value. I did not use the validation regex in the field type specifications because it is not fixed to a single currency.

 

My code is working on the native UI, however it is not setting the value back to the oldValue in workspaces.

 

jparman_1-1698307839681.png

This code is working fine in native ui, if the cost field is not numeric it sets the unit cost field to its old value, but in workspace, doesn't work all the time. Sometimes it does, sometimes it doesn't.

 

 

 

 

 

3 REPLIES 3

jparman
Tera Guru

What i observed in the workspace is that.

1. Initial value is €22 and new value is €22a, the error message will show and revert to €22.

2. if you try again to put €22a, alert message will show but it will no longer revert to €22.

3. The key for it to work is to put first a valid value like €25 then put a wrong value €25a, then it will show the message and will revert to €22

Harsh_Deep
Giga Sage
Giga Sage

Hello @jparman 

 

Please remove return from 18th line.
Then try and let me know if it works or not

Mark Correct if this solves your issue and also mark 👍Helpful if you find my response worthy based on the impact.

Thanks

Hi Harsh,

 

It did not work. 😞