- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
The line which specifies the Function name within the script include MUST be adding the parameter sysparm_name, and you are asking for trouble naming the Script Include and the Function the same name. Also, the getParameter in the Script Include has to use the same value as the addParam in the Client Script.
1) change the name of the Script Include and the Glide Ajax line,
2) the first addParam should look more like this:
gh.addParam('sysparm_name', 'getEmail');
In the Script Include, the getParameter line needs to agree, so
var peru = this.getParameter('sysparm_user_name');
These changes will get you closer. There may still be a syntax or logic error, but you have the logs to help spot that. Here's an excellent guide on how Glide Ajax works. The example returns more than one value, which you will need sooner or later.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
The line which specifies the Function name within the script include MUST be adding the parameter sysparm_name, and you are asking for trouble naming the Script Include and the Function the same name. Also, the getParameter in the Script Include has to use the same value as the addParam in the Client Script.
1) change the name of the Script Include and the Glide Ajax line,
2) the first addParam should look more like this:
gh.addParam('sysparm_name', 'getEmail');
In the Script Include, the getParameter line needs to agree, so
var peru = this.getParameter('sysparm_user_name');
These changes will get you closer. There may still be a syntax or logic error, but you have the logs to help spot that. Here's an excellent guide on how Glide Ajax works. The example returns more than one value, which you will need sooner or later.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
check points mentioned from @Brad Bowman
There are lot of GlideAjax articles which you can check and fix your code.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@sntrainingss There are few syntax mistakes in your code, refer below article which explain glideAjax with examples:
https://www.servicenow.com/community/developer-articles/glideajax-example-cheat-sheet/ta-p/2312430
Also, you don't have to return object and parse the object incase you are returning single value from script include.