Report on assignment lookup rules and subcategories

GB14
Kilo Patron

Is there a way to create a report on the incident subcategories and assignment lookup rules (dl_u_assignment) and find out which subcategories is missing from the assignment lookup rules? 

I tried creating database view but I am getting thousands or records 

An suggestions on how to achieve this solution? 

 

1 ACCEPTED SOLUTION

Chaitanya ILCR
Mega Patron

Hi @GB14 ,

if you just want to find out which choices are missing in the assignment lookup rules you can run a background script and find out 

 

var arrChoices = []

var chGr = new GlideRecord("sys_choice");
chGr.addEncodedQuery("name=incident^element=subcategory");
chGr.query();
while (chGr.next()) {
    var aGr = new GlideRecord('dl_u_assignment');
    aGr.addEncodedQuery('subcategory=' + chGr.getValue('value'));
    aGr.setLimit(1);
    aGr.query();
    if (!aGr.hasNext()) {
		var tempObj ={};
		tempObj.choiceLabel = chGr.getValue('label');
		tempObj.choiceValue = chGr.getValue('value');
		tempObj.choiceSysId = chGr.getValue('sys_id');
        arrChoices.push(tempObj);
    }

}
gs.print(JSON.stringify(arrChoices))

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

View solution in original post

2 REPLIES 2

Shivalika
Mega Sage

Hello @GB14 

 

Did you try normal standard reporting on Assignment lookup table ? You can just add relevant filters. Can you share screenshot what you did in this aspect ? 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

Chaitanya ILCR
Mega Patron

Hi @GB14 ,

if you just want to find out which choices are missing in the assignment lookup rules you can run a background script and find out 

 

var arrChoices = []

var chGr = new GlideRecord("sys_choice");
chGr.addEncodedQuery("name=incident^element=subcategory");
chGr.query();
while (chGr.next()) {
    var aGr = new GlideRecord('dl_u_assignment');
    aGr.addEncodedQuery('subcategory=' + chGr.getValue('value'));
    aGr.setLimit(1);
    aGr.query();
    if (!aGr.hasNext()) {
		var tempObj ={};
		tempObj.choiceLabel = chGr.getValue('label');
		tempObj.choiceValue = chGr.getValue('value');
		tempObj.choiceSysId = chGr.getValue('sys_id');
        arrChoices.push(tempObj);
    }

}
gs.print(JSON.stringify(arrChoices))

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya