Why im not getting any log

Alon Grod
Tera Expert

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'
});

 

8 REPLIES 8

Community Alums
Not applicable

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

@Community Alums still not see any log

Community Alums
Not applicable

Hi @Alon Grod,

 

If you are creating this script in scoped application than use gs.info(), gs.log() only works in global scope.

newhand
Mega Sage

@Alon Grod 

use gs.info();

 
 
Please mark my answer as correct and helpful based on Impact.