- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2021 11:05 AM
Hi I am getting below error when i am trying to call the scripted REST API with below script. Can someone please verify below script and correct me if anything wrong.
Error: <?xml version="1.0" encoding="UTF-8"?><response><error><detail>ReferenceError: "XMLHelper" is not defined. (sys_ws_operation.b35de1cdff0f2010905087f8b721f1cc.operation_script; line 22)</detail><message>"XMLHelper" is not defined.</message></error><status>failure</status></response>
Script.
(function process( /*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
// implement resource heere
var ShortDesc;
var TOnum = request.pathParams.change_number;
var body = {};
var grTO = new GlideRecord('change_request');
grTO.addQuery('number', TOnum);
grTO.query();
if (grTO.next()) {
body.GroupName = grTO.getDisplayValue('assignment_group');
body.State = grTO.getDisplayValue('state');
}
/* response.setContentType('application/JSON');
var writer = response.getStreamWriter();
writer.writeString(JSON.stringify(body));
*/
response.setContentType('application/xml');
var writer = response.getStreamWriter();
var xhelper = new XMLHelper();
writer.writeString(xhelper.toXMLStr(body));
})(request, response);
Solved! Go to Solution.
- Labels:
-
Integrations

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2021 02:45 PM
Hi,
Is the scripted rest API within a custom scope? XMLHelper is only available in the global scope.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2021 02:45 PM
Hi,
Is the scripted rest API within a custom scope? XMLHelper is only available in the global scope.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2021 06:04 AM
i am not sure. where can we check this setting(custom scope or Global scope) ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2021 06:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2021 06:41 AM
looks like i selected custom scope. i will change to global and test it.
Appreciate it, thanks lot !!