Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

There is a JavaScript error in your browser console- Catalog Client script in Service Portal

ServiceNow10sun
Giga Guru

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

 

@Saurav11 @Ankur Bawiskar 

2 ACCEPTED SOLUTIONS

Muhammad Khan
Mega Sage

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

View solution in original post

Saurav11
Kilo Patron
Kilo Patron

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. 

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@ServiceNow10sun 

Points mentioned by members should help you resolve your query

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader