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

aditya174
Tera Guru

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

kotharir
Tera Expert

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();

Abhishek Singh6
Kilo Guru

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.

rajesh1512
Tera Contributor

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.