- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2022 10:24 PM
Hi All ,
Everytime i write Catalog Onchange cleint script i get Error as ' There is a JavaScript error in your browser console '
,Could you any one let me know the issue .
My Requirement is a message ( Hi Urgency 2 ) should come in service portal when in the catalog name' Incident' field name 'urgency' choice '2- High ' is selected similarly for if choice '3-Medium' then message ( Hi urgency 3) and for choice '4-Low' then message should come as ( Hi urgency 4) .
Also need suggestion are we not suppose to use Onchange client script on service portal ?
i have tried basic message to check if it works or not but got same error :
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(newValue==2)
{
g_form.addInfoMessage(Hi);
}
//Type appropriate comment here, and begin script below
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2022 10:31 PM
Place your message in quotes.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(newValue==2)
{
g_form.addInfoMessage('Hi');
}
//Type appropriate comment here, and begin script below
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2022 10:42 PM
Hello,
As Muhammad correctly pointed out it is because of the info message not being in the quotes:-
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(newValue==2)
{
g_form.addInfoMessage('Hi');
}
}
Please mark answer correct/helpful based on Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2022 11:13 PM
Points mentioned by members should help you resolve your query
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
