- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2021 07:28 AM
I am trying to find a script that will give me the list of active users within an Assignment Group and when was the list time an INC record was assigned to the user.
I can't find an OOB field in the [incident] table that stores the data. Hope someone can walk me through on which table to query to achieve this requirement.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2021 07:48 AM
Hello,
please test the below:
var grmbm=new GlideRecord("sys_user_grmember");
var sysId = ; //enter your group sys_id here
grmbm.addQuery("group",sysId);
grmbm.query();
while (grmbm.next()){
var metric = new GlideRecord("metric_instance");
metric.orderByDesc('sys_created_on');
metric.addEncodedQuery('definition.table=incident^definition.name=Assigned to Duration^value='+grmbm.user.name);
metric.setLimit(1);
metric.query();
if (metric.next()){
// [enter script to save data here]
}
}
Hope this helps!
Tudor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2021 07:43 AM
Hi,
Why is this important --> when was the list time an INC record was assigned to the user??
-A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2021 09:08 AM
This is for our INC assignment routing conditions.
One use case is:
- An INC record has been created and assigned to Group A
- Check the active users of Group A
- Check the number of tickets for each user in Group A per month
- Sort the user by number of tickets assigned
- If there is only 1 user with the least number of INC that month:
- assign the INC to the user
- If there is 2 or more users with the least number of INC:
- assign the INC to the user with oldest assigned INC record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2021 07:48 AM
Hello,
please test the below:
var grmbm=new GlideRecord("sys_user_grmember");
var sysId = ; //enter your group sys_id here
grmbm.addQuery("group",sysId);
grmbm.query();
while (grmbm.next()){
var metric = new GlideRecord("metric_instance");
metric.orderByDesc('sys_created_on');
metric.addEncodedQuery('definition.table=incident^definition.name=Assigned to Duration^value='+grmbm.user.name);
metric.setLimit(1);
metric.query();
if (metric.next()){
// [enter script to save data here]
}
}
Hope this helps!
Tudor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2021 09:12 AM
Thank You - This helps the [metric_instance] table.