Question about JAVAscript in Reports

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2024 02:59 PM
I recently started a job, the previous person already left. I am reviewing a Report previously built. I am very familiar with Reports, however I am unclear on this.
Table: alm_asset
These two Conditions were added:
(1) Configuration Item.Reporting class is one of javascript: new SmbcEOLUtils().getSFTClasses()
(2) Configuration Item.Company.Sys ID is one of javascript:global.getGroupCompaniesForRegion("AD-CUSO");
Can someone help what these are filtering or doing for the report? Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2024 06:36 AM - edited 03-09-2024 06:37 AM
Hello @Marc Schlank1 ,
-
Configuration Item.Reporting class is one of javascript: new SmbcEOLUtils().getSFTClasses()
This condition is calling a JavaScript function
getSFTClasses()
that resides inSmbcEOLUtils
script include or global business rule. This function likely returns an array of Sys IDs representing specific reporting classes. Configuration Items belonging to these classes will be included in the report. -
Configuration Item.Company.Sys ID is one of javascript:global.getGroupCompaniesForRegion("AD-CUSO")
Similarly, this condition calls a global JavaScript function named
getGroupCompaniesForRegion
with a parameter "AD-CUSO". This function presumably fetches an array of Sys IDs representing companies associated with the specified region (in this case, "AD-CUSO"). Configuration Items with Company field matching these Sys IDs will be included in the report.In order to find them, navigate to System Definition > Scripts - Background and paste in the following scripts separately and execute them:
var gr = new GlideRecord('sys_script_include'); gr.addQuery('api_name', 'SmbcEOLUtils'); gr.query(); if (gr.next()) { gs.info(gr.getValue('script')); }
Hope this helps and gets you the understanding to start digging into your work.
Please hit helpful and correct solution if you are happy with the reply
Thanks
Amarjeet Pal