- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2023 01:05 AM
Hi Team,
While using a CCS, ( attached screen shot ) in which I have made a GlideAjax call, I am getting a error stating "There is a JavaScript error in your browser console". The values are getting populated in the back end instance while 'try it' but in portal it is throwing the error.
I need the data to populate the Catalog Item Fields on the Portal. Any suggestion as to how can I achieve this?
Regards,
Saurabh
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2023 02:48 AM
It seems that g_user.getUserID() is not supported in Service portal
You can do one thing instead of sending it from front end, please get the loggedin user in the backend itself as gs.getUserID() (inside script include);
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2023 01:24 AM
As I have seen you used getXMLAnswer in the script, getXMLAnswer is not supported in Service portal, it is supported in Native UI
Please try to update the getXMLAnswer to getXML it will not through the error, but it is dependent completely on your use case
If my answer solved your issue, please mark my answer as Correct & Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2023 01:50 AM
Hi @Prince Nope it is still showing the same error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2023 02:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2023 02:28 AM
function onLoad() {
//Type appropriate comment here, and begin script below
g_form.setValue('requested_for', g_user.getFullName());
var ga1 = new GlideAjax('GetUserDetails');
ga1.addParam('sysparm_name', 'GetUserDetail');
ga1.addParam('sysparm_userid', g_user.getUserID());
ga1.getXML(callback);
function callback(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
//answer = JSON.parse(answer);
g_form.setValue('requester_manager', answer);
g_form.setValue('location', answer[1]);
g_form.setValue('email', answer[2]);