I made a formula to translate NotReady reasons to (hh:mm:ss) Reason. However, I also want to make a condition that if the agent isn’t NotReady, the formula should output what is basically “ExtendedCurrentState”.
I tried with "return ccpulse.group(“MyAgentStateGroup”).statistic(“ExtendedCurrentState”).
However when I do this, it only returns weird numbers, like 4 or 22. How can I get the output of the Status column for agents that are not NotReady exactly as it is in the “StatusAlt” column on the screenshot?
Alternatively, I tried with state.Status. This returns the correct state as text, but how can I get the current time in the state with it?
Solution to this: use the state object with state.StartTime and state.Status
After evaluating for all reason codes, if the current status is NOT NotReadyForNextCall(Reason) then do this:
var startzeit = state.StartTime;
var datumob = new Date(startzeit);
var datumobtoms = datumob.valueOf();
var datumob2 = new Date();
var differenz = (datumob2.getTime() - datumobtoms) / 1000;
var d = differenz
var h = Math.floor(d / 3600);
var m = Math.floor(d % 3600 / 60);
var s = Math.floor(d % 3600 % 60);
var f = ((h > 0 ? (h < 10 ? “0” : “”) + h + “:” : “00:”) + (m > 0 ? (m < 10 ? “0” : “”) + m + “:” : “00:”) + (s < 10 ? “0” : “”) + s);
return “(” + f + ") " + state.Status;