Why im not getting any log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2023 12:43 AM
Hi,
Im trying to use onLoad client Script and Script include to execute an action and in order to test myself im trying to use gs.log inside the script include but im not getting any log.
function onLoad() {
//Type appropriate comment here, and begin script below
var ga = new GlideAjax('SetRecordChangedFalse'); //this is the script include
var id = g_user.userID;
ga.addParam('sysparm_name', 'isHamal'); //this is the function within the script include
ga.addParam('sysparm_std', id);
ga.getXML(getResponse);
}
function getResponse(response) {
var ans = response.responseXML.documentElement.getAttribute('answer');
if (ans == 'true' && g_form.getValue(u_record_changed)=='true') {
g_form.setValue('u_record_changed', false);
}
}
var SetRecordChangedFalse = Class.create();
SetRecordChangedFalse.prototype = Object.extendsObject(AbstractAjaxProcessor, {
isHamal: function(user) {
var std = this.getParameter('sysparm_std');
gs.log('Alon: ' + std);
var standardFields = new GlideRecord('sys_user_grmember');
standardFields.addQuery('user', std);
standardFields.query();
while (standardFields.next()) {
var group_name = standardFields.group.toString();
var gr = new GlideRecord('sys_user_group');
gr.addEncodedQuery('name='+group_name+'^u_hamal=true');
gr.query();
if(gr.next()){
return true;
}
}
},
type: 'SetRecordChangedFalse'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2023 01:04 AM
Hi @Alon Grod try using gs.info(); or alert(); because gs.log is used on the server side so you can go by either two.
Please mark my answer correct if you found it helpful.
Regards,
Aditya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2023 01:07 AM
Hi @Alon Grod
There could be two reason.
1.If the script include is client callable, check the "Access controls" related list on Script include. The ACL might blocking to execute the script include.
2.If your script include is created under scopped application then please gs.info();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2023 01:11 AM
Hi @Alon Grod,
Have you created this script include in global or scoped application.
If you have created it in scoped application, Use gs.info() instead.
gs.log() and gs.print() doesn't work in scoped application.
Please mark helpful and accept solution if it helped you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2023 01:27 AM
Following could be the reasons:
1. try using gs.info(); or gs.error() if using scoped application.
2. Check if the script include is client callable.