Debugging a scripted breakdown mapping in PA

Abhiji322
Tera Expert

Hi all,

My question is direct. Is there any way by which we can trace the output of a scripted breakdown mapping? I have one of the similar kind that never shows an error in the logs whenever the data collector job runs but the breakdown scores are not populated. [ Breakdown is not applied while computing the score].

 

A scripted mapping was necessary to fulfill the business requirement since dot-walking was not an option.

Requirement: A breakdown that segregates data based upon service. parent. subcategory to use on problem based indicators. I created a scripted as given below.

 

Facts table - Problem

Field(s) selected - service

 

var result=function(current){

var gr=new GlideRecord('cmdb_rel_ci');

gr. addEncodedQuery('child='+current. business_service. toString());

gr. query();

if(gr.next()){

    return gr. parent. subcategory;

}

};

result(current);

[Ignore syntax errors]

 

Any suggestions much appreciated.

 

1 ACCEPTED SOLUTION

Abhiji322
Tera Expert

Addons to refer the issue.

 

Breakdown Source:

Abhiji322_1-1702881351803.png

Breakdown Mapping: 

Abhiji322_2-1702881465821.png

 

 

 

 

View solution in original post

6 REPLIES 6

Bert_c1
Kilo Patron

Post the Data Collection Job error, those are very useful and informative on what the problem is.

Abhiji322
Tera Expert

@Bert_c1 , I think you haven't read my query properly. I said that the job is running fine without any errors but the scores are not getting populated breakdown wise.

Abhiji322
Tera Expert

Addons to refer the issue.

 

Breakdown Source:

Abhiji322_1-1702881351803.png

Breakdown Mapping: 

Abhiji322_2-1702881465821.png

 

 

 

 

Bert_c1
Kilo Patron

problem.business_service is a reference field to 'cmdb_ci_service'. Querying cmdb_rel_ci.child is not likely to work as intended as that field is a reference field to 'cmdb_ci'.

 

Your breakdown source is defined on the 'sys_choice' table. A query of that table using the 3 conditions you posted only returns records for 'subcategory' field on the 'cmdb_categories' table.

 

You do not return any value when the query on 'cmdb_rel_ci' record is not found. OOB scripted breakdowns do return a value or '' (null).

 

You should post your requirement, with details that include the Indicator, Indicator Source.  Seems you want to have a breakdown on the choice value of 'subcategory' defined on the cmdb_rel_ci table, that matches the problem.business_service value?

 

There is a Performance Analytics course here: https://developer.servicenow.com/dev.do#!/learn/courses/vancouver

 

Good luck.

 

Also review the Data collection job log for any breakdown related information.