Question on Script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I wrote a script include in Employee center core and a client script in the same application for a record producer.
There I have a requirement to check if Requested for is a member of HR groups or not.
I created a field and marking it based on the script include and client script
Client script
Script include:
ANy suggestions what I am missing?
it works but also gives an error of "ErrorThere is a JavaScript error in your browser console"
Any help is highly appreciated.
Thank yoU!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @Ashutosh4 ,
As I can see in your error screenshot there is "Unhandled exception in glide Ajax" :
So I would recommend, Instead of returning just a string, wrap your values in an object, JSON.stringify() it in the Script Include, and JSON.parse() it in the client script. That way you avoid unhandled exceptions and can easily extend your GlideAjax responses with more data later.
Plz refer this :
Unhandled exception in GlideAjax
If my response helped mark as helpful and accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello
Please Make Sure Below Points are correct:
1) Script Include is Client Callable i.e Glide AJAX enabled is checked : Reason is - it Extends the OOB AbstrractAjaxProcessor Script Include. If it isn't True, Glide Ajax Call will always be False
2) Script Include Should be in Global OR Same Scope ideally
3) I doubt alert will help here : use console.log('HR Ops Member:', answer);
Try the below Code Which I have Written. I have not tested, it as I don't keep same set up as you in PDI
Catalog Client Script :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Tried, still throws the error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
Guys there was an issue with how the script include was being called.
Many Thanks!
