Simple onChange catalog clinet script don't call scritp include

JohnDF
Mega Sage

Hi everyone,
I have created a client script for a ServiceNow Catalog Item, along with a corresponding Script Include. However, I am consistently encountering my created "API call failed" error message. This Script Include is currently very basic, designed to simply return the string 'success' and so it should response the error message "

API call success"

.
JohnDF_0-1726994390380.pngJohnDF_1-1726994422122.png

I have attempted to trigger the Script Include using both 'onChange' and 'onLoad' client scripts, but neither approach has been successful in receiving the expected 'success' response. I am unable to determine the root cause of this failure. Could you please help me identify the issue and provide guidance on how to resolve it? Thank you!

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@JohnDF I found an issue with your script include, initially you created a server side script include(Client callable unchecked), and later on chose to make it a client callable. Please update your script include as follows and see if it works.

 

var RErequestAPI = Class.create();
RErequestAPI.prototype = Object.extendsObject(AbstractAjaxProcessor, {

getCatItems: function(){
return 'success';
},
type:'RErequestAPI'
});

 

Please mark the response helpful and accepted solution if it manages to answer your question.

 

View solution in original post

1 REPLY 1

Sandeep Rajput
Tera Patron
Tera Patron

@JohnDF I found an issue with your script include, initially you created a server side script include(Client callable unchecked), and later on chose to make it a client callable. Please update your script include as follows and see if it works.

 

var RErequestAPI = Class.create();
RErequestAPI.prototype = Object.extendsObject(AbstractAjaxProcessor, {

getCatItems: function(){
return 'success';
},
type:'RErequestAPI'
});

 

Please mark the response helpful and accepted solution if it manages to answer your question.