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 12:56 AM
Hi @Alon Grod ,
Change the function in the script include as
isHamal: function()
If you are facing issues in using script include, take a look at this community link.
If this solves your issue, mark this as correct and helpful.
Regards
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2023 12:57 AM
@Community Alums still not see any log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2023 02:23 AM
Hi @Alon Grod,
If you are creating this script in scoped application than use gs.info(), gs.log() only works in global scope.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2023 01:00 AM