GlideAjax: Not able to access function inside script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2015 01:14 PM
I have created a custom application and i am trying to do a GlideAjax, though onSubmit client script , to access a script include within the same scope. I put a debug statement each inside the 'initialize' and 'testfunction' which i am calling in my client script. I found that on execution of the script only the debug statement inside initialize is reflecting in the System Logs. Is the 'testfunction' not getting called at all? The value in the 'answer' variable is also null after execution.
Following is my script include:
Corresponding Client Script:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2016 08:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2016 08:43 AM
Hello Michael,
I assume that the logging on line 13 of your Script Include outputs a value in your script logs, so you know that there is a record being found?
Change line 18 to use gr.getValue("status") instead of "gr.status".
Also, can you log the value of answer in your client script (before the "if (answer)" conditional on line 14)? Use "console.log(answer)" and check out what is logged out to your browser's console when this runs.
Thanks
Cory

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2016 09:08 AM
Hi Cory,
Thanks for the quick response.
So unfortunately, I don't even get to the first log statement on Line 6 in the Script Include. I did change grabbing the value to gr.getValue
As well, I outputted to the console:
Also, I tried to remove the scope from the object creation in the client script, with the same result:
ie. FROM: var ga = new GlideAjax('x_prdr_rig_staff.RigCrewingUtilsAJAX');
TO: var ga = new GlideAjax('RigCrewingUtilsAJAX');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2016 09:19 AM
Hi Michael,
Blergh. Sorry I missed this. In your GlideAjax call, you do *not* need the "x_prdr_rig_staff" prefix. This is a Client Script within your scoped application, so you don't need to append your own scope name.
Update your Client Script, line 5, to remove the scope prefix:
var ga = new GlideAjax("RigCrewingUtilsAJAX");

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2016 09:26 AM