- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2023 08:47 PM
Hello Community,
I have a requirement where I want to write script to check if two fields on the catalog form have same value.
For ex: I need to validate that if field Business System Owner is equal to Service Manager and vice versa and trigger an alert that 'bso' (Business System Owner) cannot be same as System Manager.
I have written below Client script, but it is going in infinite loop:
Maybe at the time loading form, both fields are empty that's why it is going in infinite loop.
Could you please help to achieve this requirement ?
Thanks in advance,
Hritik
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2023 09:02 PM - edited ‎01-15-2023 09:05 PM
Hi,
If you see the 2nd line of the script there is condition for the formloading and if the field is empty, and within that if condition you have inlcuded your whole code.
I would suggest, keep the default code as it is, and add your script after that.
There is no need for adding return in the else statement, put it back with the first if condition and add your code outside the first if.
It should be something like:
if(isLoading || newValue =="'){
return;
}
var a = g_form.getValue("bso");
var b = g_form.getValue("service_manager");
if(a == b){
alert("your message);
g_form.clearValue("bso");
}
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2023 09:02 PM - edited ‎01-15-2023 09:05 PM
Hi,
If you see the 2nd line of the script there is condition for the formloading and if the field is empty, and within that if condition you have inlcuded your whole code.
I would suggest, keep the default code as it is, and add your script after that.
There is no need for adding return in the else statement, put it back with the first if condition and add your code outside the first if.
It should be something like:
if(isLoading || newValue =="'){
return;
}
var a = g_form.getValue("bso");
var b = g_form.getValue("service_manager");
if(a == b){
alert("your message);
g_form.clearValue("bso");
}
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2023 12:55 AM
Hi Comunity,
I want a requirement on Incident Form ,when the caller field and assigned to both fields are having same names then i need to add error message.
please give me the client script for this requirment using on
submit type