onchange script oldValue not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2023 12:37 AM
hi , I have written below catalog client script but it is not working
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
if (oldValue == 'Yes' && newValue == 'No') {
alert('triggering');
g_form.clearValue('variable1');
g_form.clearValue('variable2');
}
I removed oldvalue part then alert is coming but when I removed newvalue part then this alert is not triggering , so that oldvalue is not working , please help me to fix it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2023 12:44 AM
Hi @Amit Dey1 ,
Can you drop the screenshot of catalog Item ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2023 12:49 AM
Hi @Amit Dey1 ,
Can you share screen shots of the variable definition and the client script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2023 12:51 AM
Hello @Amit Dey1
I have tried the script that you have provided.
The script works perfectly fine for me.
Can you please check if there is any other client script or UI policy defined for the field configured in the client script.
Say for example the client script is configured to run on the change of field - FIELD_1
- You need to check how many client scripts are there where this field is called in the script.
- You need to check all the UI policies where this field is used in the UI policy condition, Execute if true & Execute if false scripts, and also in the UI policy actions.
If you find any, deactivate them and then see how the client script mentioned above works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2023 01:10 AM
HI @Amit Dey1 ,
Tip while working with old, new values:
For an instance, if oldValue=apple & newValue=grape.
after doing some action (newValue=banana) the oldvalue is still apple not grape.
so watch out the field values attentively.