gs.getproperty not working

Venkat122
Kilo Guru

Hi All,

I am using script include in report for some complex query. To make this dynamic i am taking some values from sys_properties table using gs.getProperty() method. But when i use it in script include it is not working. same script is working when i checked by running in background. Is this an expected behavior? How we can overcome this problem?

script include:

name: getIncidents

client callable: true

script:

function getIncidents()

{

var arr = [];

var query = gs.getProperty('Custom.incident.query');

var gr = new GlideRecord('incident');

gr.addEncodedQuery(query.toString());

gr.query();

while(gr.next())

{

arr.push(gr.sys_id+'');

}

return arr.toString();

}

Form list view, i am calling it as

sys id --is one of-- javascript:getIncidents()

Build version: isthanbul

Thanks and regards

Swamy

21 REPLIES 21

nayanawadhiya1
Kilo Sage

Please share Script Include Code.


lks
ServiceNow Employee
ServiceNow Employee

No, this is not an expected behavior. Please check the application scope if that helps.


Chuck Tomasi
Tera Patron

Please provide the code and the requirement behind it so we can see not only what you are doing, but understand the purpose of what you are trying to do.



FYI - gs.getProperty() hasn't failed me yet in a script include.


Hi All,



Thanks for your reply!



script include:


name: getIncidents


client callable: true


script:



function getIncidents()


{


var arr = [];


var query = gs.getProperty('Custom.incident.query');


var gr = new GlideRecord('incident');


gr.addEncodedQuery(query.toString());


gr.query();


while(gr.next())


{


arr.push(gr.sys_id+'');


}



return arr.toString();



}



Form list view, i am calling it as


sys id --is one of-- javascript:getIncidents()



Build version: isthanbul