- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2024 04:23 PM - edited 03-19-2024 04:42 PM
Hi there,
when working with a scoped Script Include, I face the issue, that I cannot write into the document of the request.
My Script Include is defined similar to this:
var TestAjax = Class.create();
TestAjax.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
initialize: function() {
},
testFunction: function() {
var gr = new GlideRecord('sys_user');
gr.query();
while (gr.next()) {
var item = this.newItem(); // <--- `item` is undefined
item.setAttribute('sys_id', gr.getValue('sys_id'));
item.setAttribute('name', gr.getValue('name'));
}
},
type: 'TestAjax'
});
When testing this Script Include via a Fix Script, I receive the following error:
Evaluator: com.glide.script.RhinoEcmaError: The undefined value has no properties.
script : Line(10) column(0)
Line 10 is the line where I first try to set an attribute for the item element, indicating that item is undefined.
Thanks to @Alikutty A who describes the implementation of this.newItem(), I also tried to explicitly redefine this method in the scoped Script Include. But unfortunately, this also did not solve the issue.
Is there anything to take special car of when writing Script Includes for scoped applications other than using global.AbstractAjaxProcessor instead of AbstractAjaxProcessor?
Any help is much appreciated! Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 08:59 PM
Looking like the Client Callable checkbox is missing in your script include. Make sure your to enable it.
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 08:59 PM
Looking like the Client Callable checkbox is missing in your script include. Make sure your to enable it.
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2024 02:40 PM
Hey @Tai Vu,
thank you again for your support! Indeed, the checkbox was the reason for that issue 🙄
Really appreciate your help here!
Best wishes,
Carl