gs.log()

Vignesha Priya
Tera Contributor

var checking_user_is_part_of_specific_Group = Class.create();
checking_user_is_part_of_specific_Group.prototype = {
initialize: function() {
},

isUserPartOfGroups: function(groupNames) {
var chg = new GlideRecord('change_request');
var user = new GlideRecord('sys_user');
var reqby = chg.getValue('requested_by');
var cond = user.get('name',reqby)

if (cond)
{
var userEmail = user.getValue('email');
for (var i = 0; i < groupNames.length; i++) {
var group = new GlideRecord('sys_user_group');
if (group.get('name', groupNames[i])) {
var groupHasUser = new GlideRecord('sys_user_grmember');
groupHasUser.addQuery('user',user.getValue('user_name'));
groupHasUser.addQuery('group', group.getValue('sys_id'));
groupHasUser.query();
if (groupHasUser.next()) {
gs.log (" Vignesha priya log checking" + userEmail);
}
else
{
gs.log (" Vignesha priya log checking - user is not part of the group");
}
}
}
}
gs.log (" Vignesha priya log checking - User is not in user table");
},

type: 'checking_user_is_part_of_specific_Group'
};

This is my script include. I need to check output of the script include. I am using gs.log(). May I know if the format is correct. Where can I check log statement. I am not finding it under System logs. I call this in change approval decision.

VigneshaPriya_0-1684142084705.png

I try to check the condition by creating a change request with the highlighted condition. 

5 REPLIES 5

Dear @Vignesha Priya 

I apoligized, i used the wrong word as scope, correct is Source.

Yes....  gs.log('My incident number ' +gr.number , '4444');

 

Goto syslog.LIST, give source is 4444 (any value can possible) , it will give your logs in the syslog table.

 

KB18_0-1684220934899.png

 

Please hit the thumb Icon and mark as correct in case I help you with your query!!!
- Kailas