why alert is not displaying in catalog client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2022 06:09 AM
Hi ,
when i try to give alert in catalog client script, it is not displaying anything.
please refer the code,
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var request1 = g_form.getValue('request');
if(request1 =='Complete a job in IWS')
{
alert('Job should be only in Error state');
}
//Type appropriate comment here, and begin script below
}
Thank You.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2022 09:21 AM
Hi Gamarawaji,
Three things to check here:
1)UI type in catalog client script is matching the same where you are checking
2)Whether is it triggering on change of the variable? To check whether the catalog client script is executing, first alert above the condition.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
alert('yes the script is running');
var request1 = g_form.getValue('request');
if(request1 =='Complete a job in IWS')
{
alert('Job should be only in Error state');
}
//Type appropriate comment here, and begin script below
}
3)Check whether the correct checkboxes are turned true
Post checking all these if the issue is still not resolved,it would be great if you could paste the screenshots step by step by alerting the value(request1),it will be easy to figure out the issue.
Please mark the answer helpful, if it resolved your issue.
-Krupamayee.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2022 04:25 PM
Trying outputting content of variable "request1" to make sure it is the same. In JavaScript, uppercase and lowercase are treated as different.
Try the code below. If the second alert if displaying "false", make sure there is no special characters instead of a
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var request1 = g_form.getValue('request');
var str = 'Complete a job in IWS';
alert(request1);
alert(request1 == str);
alert('request1 length:' + request1.length + ' string length:' + str.length);
if(request1 == 'Complete a job in IWS')
{
alert('Job should be only in Error state');
}
//Type appropriate comment here, and begin script below
}
If request field is a select box, the value of choices are defined in the "Value" field and not the "Text" field. Be sure to "Complete a job in IWS" is in the "Value" field as below.