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
‎10-03-2015 07:07 PM
Hi Jivonjot,
Don't prefix your script name with your scope- it's not needed if the Client Script and the Script Include being called are in the same scope.
Also, don't call setScope in your GlideAjax object. You never need to do that either.
Fix those 2 things, and I think you'll be good to go.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2015 12:22 AM
Hi Cory,
I had initially tried without setting the scope at those 2 places, but it did not work, so i added them as a just-in-case measure. The porblem seems to be that the testfunction is not getting called at all (the 2nd log statement is not getting executed) regardless of the scope setting.
I feel its a very trivial thing i am missing here, but i just can't seem to pin point it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2015 12:35 AM
Hi Jivanjot,
Other than the scope stuff I mentioned before, I see nothing wrong with your Script Include nor your Client Sctipr.
Check your error log and the filesystem log when you make the request. Do you see any errors reported?
Viewing System Logs - ServiceNow Wiki
3.5 System Logs
System logs display warnings and errors within ServiceNow processes and records, and non-critical events such as memory usage on the ServiceNow server machine. This list view displays the log entries for the current day only. To view other log files, use the log file browser.
This log provides the following information for all occurrences:
Field | Description |
---|---|
Created | Date and time of the logging activity for the locale of the machine running the ServiceNow instance. |
Level | Type of message displayed. The levels are Debug, Error, Warning, and Information. A warning is an error that has been handled and recovered. An error is something that must be fixed. |
Message | System-generated message regarding the nature of the occurrence. |
Source | Name of the process or area affected by the occurrence. For example, the source of the occurrence might be EMAIL or Memory. |
3.6 Logging Utilities
ServiceNow provides the following logging utilities:
- Log file browser
- Log file download
3.6.1 Log File Browser
Use System Logs > Log File Browser to view any system log entry. You can search for log files by using the following filters:
Field | Description |
---|---|
Start time | Start date and time of the range you want to search, for the locale of the machine running the ServiceNow instance |
Session ID | System-generated hexadecimal string that identifies the session that generated the log entry. |
End time | End date and time of the range you want to search, for the locale of the machine running the ServiceNow instance |
Message | System-generated description of the occurrence. |
Level | Type of message displayed. The levels are Debug, Error, Warning, and Information. A warning is an error that has been handled and recovered. An error is something that must be fixed. |
Thread name | System-generated identifier of the thread that created the log file. |
Max rows | Maximum number of records returned for a particular filter. |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2015 01:08 AM
No Cory, there are no errors. Pradeep's setup seems to be working, i am wondering whether it is an issue with onSubmit.