Receiving error messageGlideAjax not defined
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 08:45 AM
I'm having an issue calling script include from a UI Action. I thought I would test a simple script from Background Script that returns department name from sys_user table record. Below is the client script I'm running from Background Script and the script include which is set to 'Client callable'. Both actions are in Global scope. Whenever I run the script I receive an error indicating 'GlideAjax' is not defined. It use to be that when typing the declaration line (var ga = new GlideAjax('script_include_name'), the whole GlideAjax declaration would turn italic after completing the command. This is not the case now. The script include name turns italic but GlideAjax does not (var ga = new GlideAjax('script_include_name'). I can confirm that 'AbstractAjaxProcessor' is in the system.
Any help is greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 08:57 AM - edited 09-18-2023 08:58 AM
Hello @Jeff96 ,
U cannot execute client script code in Background Script as Background script is a Server side Script.
Read more about it here:
Please mark my response helpful if it resolves your issue.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 09:47 AM
You're gonna hate it if this is the right answer, but from what you posted it looks like your SI definition user a lowercase U and your script is calling it using an uppercase U.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 10:04 AM
Hi Tera Expert,
Sorry, I've best working on this for a while and copied the wrong script. It doesn't work with lowercase u in script include name as well (var ga = new GlideAjax('g_userDepartmentDetail');. I thought that was my issue as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 10:19 AM - edited 09-18-2023 10:19 AM
Hi @Jeff96 ,
You can test ur script include from background script by calling it this way.
var execOutput = new g_userDepartmentDetail().details(Id);// enter hard-coded sys I'd in string