Scenario: Check the previous value of state field and if not matches set the field value to current. Can any one explain me this scenario And how to debug it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2021 09:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2021 01:06 PM
The Problem is you are running client script on change of the state field and at the same time you are changing the same field so this script is running recursively until the error stops it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2021 08:47 PM
Hi Soumya,
Please use below script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
g_form.addInfoMessage('oldValue: ' + oldValue);
if (oldValue != newValue) {
//g_form.setValue('state',newValue);// This line is not required because state field is already have new value, do something else
}
else {
alert('Prvoide new State..');
}
g_form.addInfoMessage('newValue: ' + newValue);
}
As mentioned by Prasad, you are setting setting state value again through the script is making iterative call to same client script which is recursive call and impacting performance.
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2021 02:50 AM
Thank You it worked fine for me.
Regards,
Soumya

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2021 07:01 AM
Glad to know that your issue is resolved, could you please close this question by marking appropriate answer as correct answer?
This will be helpful for other community member to refer solution in future.
Thanks,
Anil Lande
Thanks
Anil Lande