Question about JAVAscript in Reports

Marc Schlank1
Tera Contributor

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.

5 REPLIES 5

Amarjeet Pal
Kilo Sage
Kilo Sage

Hello @Marc Schlank1 ,

  1. Configuration Item.Reporting class is one of javascript: new SmbcEOLUtils().getSFTClasses()

    This condition is calling a JavaScript function getSFTClasses() that resides in SmbcEOLUtils 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.

  2. 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