- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2017 02:54 PM
Script I have:
var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};
var mins=function(x,y){return diff(x,y)/(24*60*1000);};
mins(current.opened_at, current.now);
I need something to replace the now that will give me the time difference from the current date time when the job is ran.
It will be used as part of a breakdown in conjunction with a bucket group if that matters. The script works above for age, but requires another field in that table to
do the calculation like current.closed_at.
Solved! Go to Solution.
- Labels:
-
Performance Analytics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2017 11:32 AM
You can use a GlideDateTime object
var diff=function(x){
var y = new GlideDateTime();
return y.getNumericValue() - x.dateNumericValue();
};
var mins=function(x){return diff(x)/(60*1000);};
mins(score_start.opened_at);
Be aware that PA is not really intended to run jobs every minute.
If you explain your requirement a bit more, maybe there is a better solution...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2017 12:13 PM
Sorry, it must be y.getNumericValue(), I have updatedmy other answer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2017 12:28 PM
Ha, you've done it! I would be happy to send you an electronic gift card for Starbucks or something.
The reason if you are curious, came about because of a response from service now for an inquiry on how to enhance something in connect UI. You see after the update it stopped showing us how long the users actually waited while they were waiting and the average wait time is useless. We noticed a sharp increase in our ASA because the chat analysts no longer knew if they were waiting 15 or 20+ mins. This caused poor chat queue management, since it would say ~2 minutes and so we never worried. We only found out how long they were waiting after the fact and never when we could do something about it. This widget will be a work around, so we can at least see during the day up to the min roughly, how things are doing in chat. I would rather not run a job every min in PA, but we need it that badly. The job does only take 1-2 seconds, so I am hoping it won't cause too much of a performance drain. Then we use a chrome plugin that auto refreshes the page this single widget contains.
"For this request there is no specific workaround directly on the Connect UI, however an alternative approach may be to create a dashboard
for the supervisor/manager to view this information. An example of how to do this could be as follows:
The chat_queue_entry table is populated for all of the chat sessions that occur in the platform. You could put a filter on this table to
restrict it to only show the waiting entries (state = 1) and also order the list by the created date (when the chat was initiated) so that the longest
waiting chats are at the top.
Out of box, the 'wait time' field isn't populated until the chat is accepted, however it would also be possible to create a scheduled job
to evaluate this table every minute or so, and update this field based on the difference between the created date and the current time.
Business Rules could also be used to create escalations etc if required."
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2017 12:51 PM
Glad I could help.
As you suggested, maybe a Scheduled Job to fill wait time would be a good alternative.
Good luck!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2021 06:25 AM
Try below script should help you to get ageing today - created:
var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};
var days=function(x,y){return diff(x,y)/(24*60*60*1000);};
days(current.opened_at, gs.nowDateTime);