Measuring the requested items previously assigned to a X group with a task assigned to Y group

dilyanai
Tera Contributor

Hi community,

I'm new to Performance Analytics and not an expert in ServiceNow, but I'm eager to learn.

My post here concerns a particular requirement.

I need to measure the number of requested items initially assigned to a "X" group that have a task assigned to a "Y" group. 

And the same requirement for cases.

I would appreciate your help. 

 

 

 

1 ACCEPTED SOLUTION

AndersBGS
Tera Patron
Tera Patron

Hi @dilyanai 

 

I could question of performance analytics is the right choice of tool based on your requirement. I would instead recommend you to create a scripted metric definition to actually capture the number of requested items where the requested item is assigned to "X" and task(S) is assigned to "Y".

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

best regards

Anders

 

 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

View solution in original post

6 REPLIES 6

vaibhav_1803
Tera Contributor

You can Use GlideRecord queries to fetch the records based on the specified criteria. You'll need to join the tables and apply filters to match the requested items initially assigned to group "X" and tasks assigned to group "Y".

You can use refer to following code snippet and run this code in scripts-background

var requestedItemGr = new GlideRecord('sc_req_item');


requestedItemGr.addQuery('assignment_group', 'X');
requestedItemGr.query();

var requestedItemsCount = 0;

while (requestedItemGr.next()) {
var taskGr = new GlideRecord('task_table_name');
taskGr.addQuery('requested_item', requestedItemGr.getUniqueValue()); taskGr.addQuery('assignment_group', 'Y');
taskGr.query();

if (taskGr.hasNext()) {
// If a task is found for this requested item assigned to group 'Y', increment the count
requestedItemsCount++;
}
}


gs.info("Number of requested items initially assigned to 'X' with tasks assigned to 'Y': " + requestedItemsCount);

Thank you, actually I don't know if it's possible and where/how to use a script from the Indicator source in Performance Analytics.

Thanks for your help vaibhav. I'll try to call a script include from the condition in the indicator source.

dilyanai
Tera Contributor

Here is a detail of my solution:

- I'm using a metric definition for the sc_req_item table for the assignment group in order to track the previously assigned group. 

- Scripted breakdown mapping

- Indicator source with facts table: sc_req_item_metric and View Table: sc_req_item

My problem is that as I'm using the database view Catalog Request Item Metric table as a facts table, I cannot access the sc_task table via the Related List Conditions. 

Maybe I should create a database view for sc_req_item_metric table and the sc_task table?

 

I'm interested in any suggestions.