- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2017 08:31 PM
Hi Team ,
I am storing a list of comma separated values in system property in the form of Json Format as shown below :
{"ticket":{"ListCI":"a,b,c,d,e,f"}}
I need to read this values in script includes . I have used the below code for the same :
var TypeCall = Class.create();
var iLookUpArray1 = [];
TypeCall.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
AutoTicketsCallType: function(){
var configItem = gs.getProperty("System Property Name");
var parser = new JSONParser();
var parsed = parser.parse(configItem);
var result = parsed.ticket.ListCI;
var gr1 = new GlideRecord('incident');
var encQy1 = 'cmdb_ci.nameIN'+result;
gr1.addQuery(encQy1);
gr1.query();
while(gr1.next()){
iLookUpArray1.push(gr1.getValue('sys_id'));
}
return iLookUpArray1;
},
type: 'TypeCall'
});
I see that comma separated values aren't read properly and I am not fetching any results . Could anyone let me know what has been missed in the above code ?
Thanks in advance .
Regards,
Ankitha
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2017 12:20 AM
Hi Ankitha,
Yes, properties do not get called from report condition builders.
You will have to take the ci name dynamically and then give it to the query.
There are some limitation to condition builder query such as gs.log don't work, gs.addInfoMessage won't work as well as gs.properties won't work.
So you have to give them or extract them in you script.
Thank you,
Ashutosh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2017 10:03 PM
So you mean that you are calling this script include in condition filter of reports?
Please show me how are you calling this.
Thank you,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2017 10:35 PM
Hi Ashutosh ,
PFB the below query which I am running in the report
SysId isOneOf javascript:new TypeCall().AutoTicketsCallType();
When I directly hardcode the query in the script(without usingJson Parsing ) , it is fetching the results in the report .
Query builder too doesn't seem to be a problem .
Regards,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2017 11:10 PM
Hi Ashutosh ,
System property is not getting called and I feel this is the root cause for this . Is there any other I can call the system property apart from gs.getProperty()?
Regards,
Ankitha

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2017 12:02 AM
HI Ankitha,
Let me try this.
Thank you,
Ashutosh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2017 12:20 AM
Hi Ankitha,
Yes, properties do not get called from report condition builders.
You will have to take the ci name dynamically and then give it to the query.
There are some limitation to condition builder query such as gs.log don't work, gs.addInfoMessage won't work as well as gs.properties won't work.
So you have to give them or extract them in you script.
Thank you,
Ashutosh