- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2019 11:07 PM
Hi All,
I want to display error when he is entering the value more than 10 in the field. Through client script it is working fine but using business rule i want to show error message in the portal.
IP Range is the field where i am actually trying for this.
Could you please help me on this,
Thank You,
Sai.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2019 11:20 PM
sample code catalog client script:
var ab = g_form.getValue('ip_range'); // make sure the variable name
if(ab > 10 ){
g_form.addErrorMessage('This is an error');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2019 12:37 AM
Hi Harsha,
The below script it is populating error messages in the catalog form and it is not populating error message in the portal..
//Type appropriate comment here, and begin script below
var gr=g_form.getValue('ip_range');
if (gr<15) // check if value is not numeric
{
//g_form.hideFieldMsg("ip_range");
g_form.addErrorMessage("Please enter a value in numbers.");
g_form.clearValue('ip_range');
} else if (gr >15) {
//g_form.hideFieldMsg("ip_range");
g_form.addErrorMessage("Please Select a quantity below 99999");
g_form.clearValue('ip_range');
}
Thank You,
Sai.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2019 12:39 AM
can you confirm the UI type set as ALL on your catalog client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2019 12:43 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2019 12:46 AM
seems like addErrorMessage() will not work on portal .
https://hi.service-now.com/kb_view.do?sysparm_article=KB0713157

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2019 12:47 AM
Hi
Instead of error message(Doesnt work on portal with g_form) can you try with the below -
var gr=g_form.getValue('ip_range');
if (gr<15) // check if value is not numeric
{
//g_form.hideFieldMsg("ip_range");
g_form.showFieldMsg("ip_range","Please enter a value in numbers.","error");
g_form.clearValue('ip_range');
} else if (gr >15) {
//g_form.hideFieldMsg("ip_range");
g_form.showFieldMsg("ip_range","Please Select a quantity below 99999","error");
g_form.clearValue('ip_range');
}
Regards
Omkar Mone