GlideAjax: Not able to access function inside script include

jivanjotkaur
ServiceNow Employee

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:

Screen Shot 2015-10-04 at 1.40.53 AM.JPG

Corresponding Client Script:

Screen Shot 2015-10-04 at 1.41.32 AM.JPG

21 REPLIES 21

Hi Michael,



Sometimes it's the simplest things. In this case, it was the gs.log statements in your Script Include. I completely missed that earlier. gs.log is not available within Scoped apps. Instead, we have create new logging methods (gs.info, gs.warn, gs.debug, gs.error). Those are detailed here:


https://wiki.servicenow.com/index.php?title=Scoped_Script_Logging



Note that the variable substitution uses {0},{1} syntax (I think I tried $0,$1 when we were debugging, because it's early and I haven't had any coffee yet).


With that last change to your server-side Script Include, this should work as intended.



Thanks,


Cory


Hi michaelrodway,

I know this post is quite time ago, but I'm running the same scenario.

Did you find a way out to have this GlideAjax self contained in Scoped application?

 

Thank you.

Regards,

Oswaldo