- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2022 03:53 PM
Hello,
We have a script include in Global scope that works like a charm when called from the client.
I would like to extend a small piece of functionality in this script include. So as a first step I created a new script include that is basically a "copy" of the existing script in all ways, except the new one is in my scoped application. Before I add functionality I want to confirm this "copy" is working like the original.
Thus when calling the new script, I call:
my_scoped_app.copied_script_include
Instead of:
global.original_script_include
However, although the original script include works, the copied script include returns null to the client.
Things I've tried:
1. I made sure both the original and the copy have exactly the same script.
2. I made sure both the original and the "copy" are Client Callable.
3. I tried changing the "Accessible from" attribute on the copied script include from "This Application Scope Only", "all application scopes" (like the original script include), but this didn't help.
4. I even tried calling 'global.copied_script_include'. That didn't work (no big surprise there). The comforting thing is the client got a 404 not found. So the 'my_scoped_app.copied_script_include' reference is reaching my copied script include.
Do I really have to put my copied script include in global scope to get it to work?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2022 01:10 PM
Yes, I logged the return value just before the return statement. The return value printed beautifully if I JSON stringified it.
return new JSON().encode(answer);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2022 04:16 PM
Hi Micheal,
Go with calling it the way you did, then add some logging - at the beginning to confirm that it is running, and whatever is happening at each step, so you can see where it stops working - calling a method that isn't available in your scope, or whatever.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2022 09:55 AM
Hi @Brad Bowman ,
Thanks for the tip. I added logging and I can see my script invoked, and I can see it successfully retrieve a record from a database table. I don't see it failing anywhere, and yet the client still receives a null.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2022 11:00 AM
Are you passing a value from the client to the Script Include, and if so does it show when logged as expected? Did you log the return value right before the return statement? It may help to post your scripts (use the insert code icon </>).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2022 01:10 PM
Yes, I logged the return value just before the return statement. The return value printed beautifully if I JSON stringified it.
return new JSON().encode(answer);