Facundo_Nowicky | 2022-04-19 16:03:02 UTC | #1
Hello,
I have implemented different versions of Data Actions querying Queues and their members for different issues. In particular this time I needed to find exclusively IDLE agents on a queue, So I used a version of @alexis.moussesian solution to count members from the API response (https://developer.genesys.cloud/forum/t/removing-totals-counts-from-the-queue-users-get-query/6106/11)
So a query to /api/v2/routing/queues/${input.QUEUE_ID}/members?routingStatus=Idle&joined=true with this translation map:
{ "translationMap": { "OnIdleAgentCount": ".entities.size()" }, "translationMapDefaults": { "OnIdleAgentCount": "0" }, "successTemplate": "{\"OnIdleAgentCount\": ${OnIdleAgentCount}}" }
This works MOSTLY ok, however, occasionally when testing with a single user, coming in and out of queue (and being IDLE). Is that sometimes it returns 16!! Experimentally it seems to happen right after returning from queue.
As a side note, There are 23 users in the queue.
This is the response from the query with the error:
Step 8: Execute:
{ "entities": [ { "id": "8f306fc1-a069-4c15-bb6d-73ad24830e0f", "name": "Servicios Argentina", "user": { "id": "8f306fc1-a069-4c15-bb6d-73ad24830e0f", "name": "Servicios Argentina", "division": { "id": "14378b4d-0181-4bc7-90a6-3c046a8c6b04", "name": "", "selfUri": "/api/v2/authorization/divisions/14378b4d-0181-4bc7-90a6-3c046a8c6b04" }, "chat": { "jabberId": "XXXXXXXXXXX@lat.orgspan.com" }, "email": "servicios-argentina@XXXXX.com", "primaryContactInfo": [ { "address": "servicios-argentina@XXXXX.com", "mediaType": "EMAIL", "type": "PRIMARY" } ], "addresses": [], "state": "active", "username": "servicios-argentina@XXXXX.com", "images": [ { "resolution": "x48", "imageUri": "https://prod-inin-directory-service-profile.s3.amazonaws.com/698b1716/d055/48ca/9e39/e01650864a3d.jpg" }, { "resolution": "x96", "imageUri": "https://prod-inin-directory-service-profile.s3.amazonaws.com/baf0904e/a728/4f4e/a466/c3bbe6372ac5.jpg" }, { "resolution": "x128", "imageUri": "https://prod-inin-directory-service-profile.s3.amazonaws.com/3c4c513a/8bf4/46fd/ae06/e9f32d4ab953.jpg" }, { "resolution": "x200", "imageUri": "https://prod-inin-directory-service-profile.s3.amazonaws.com/b0ed52dc/22c4/4420/a533/0aa269fa2c88.jpg" }, { "resolution": "x300", "imageUri": "https://prod-inin-directory-service-profile.s3.amazonaws.com/6d4924c7/2eda/4479/a392/22ef3cc448e0.jpg" }, { "resolution": "x400", "imageUri": "https://prod-inin-directory-service-profile.s3.amazonaws.com/d9d8ce5d/b92f/46d3/a6ea/949d5bf85d38.jpg" } ], "version": 77, "routingStatus": { "status": "IDLE", "startTime": "2022-04-19T14:20:16.556Z" }, "acdAutoAnswer": false, "selfUri": "/api/v2/users/8f306fc1-a069-4c15-bb6d-73ad24830e0f" }, "ringNumber": 1, "joined": true, "memberBy": "user", "routingStatus": { "status": "IDLE", "startTime": "2022-04-19T14:20:16.556Z" } } ], "pageNumber": 1, "pageSize": 25, "firstUri": "/api/v2/routing/queues/0501527b-4e3a-46b0-bcd2-44fbbf611df0/members?pageSize=25&pageNumber=1&joined=true&routingStatus=Idle", "selfUri": "/api/v2/routing/queues/0501527b-4e3a-46b0-bcd2-44fbbf611df0/members?pageSize=25&pageNumber=1&joined=true&routingStatus=Idle" }
Step 9:
{ "OnIdleAgentCount": "16", "rawResult": "{\n \"entities\" : [ {\n \"id\" : \"8f306fc1-a069-4c15-bb6d-73ad24830e0f\",\n \"name\" : \"Servicios Argentina\",\n \"user\" : {\n \"id\" : \"8f306fc1-a069-4c15-bb6d-73ad24830e0f\",\n \"name\" : \"Servicios Argentina\",\n \"division\" : {\n \"id\" : \"14378b4d-0181-4bc7-90a6-3c046a8c6b04\",\n \"name\" : \"\",\n \"selfUri\" : \"/api/v2/authorization/divisions/14378b4d-0181-4bc7-90a6-3c046a8c6b04\"\n },\n \"chat\" : {\n \"jabberId\" : \"xxxxxxxx@lat.orgspan.com\"\n },\n \"email\" : \"servicios-argentina@xxxxx.com\",\n \"primaryContactInfo\" : [ {\n \"address\" : \"servicios-argentina@xxxxx.com\",\n \"mediaType\" : \"EMAIL\",\n \"type\" : \"PRIMARY\"\n } ],\n \"addresses\" : [ ],\n \"state\" : \"active\",\n \"username\" : \"servicios-argentina@xxxxxx.com\",\n \"images\" : [ {\n \"resolution\" : \"x48\",\n \"imageUri\" : \"https://prod-inin-directory-service-profile.s3.amazonaws.com/698b1716/d055/48ca/9e39/e01650864a3d.jpg\"\n }, {\n \"resolution\" : \"x96\",\n \"imageUri\" : \"https://prod-inin-directory-service-profile.s3.amazonaws.com/baf0904e/a728/4f4e/a466/c3bbe6372ac5.jpg\"\n }, {\n \"resolution\" : \"x128\",\n \"imageUri\" : \"https://prod-inin-directory-service-profile.s3.amazonaws.com/3c4c513a/8bf4/46fd/ae06/e9f32d4ab953.jpg\"\n }, {\n \"resolution\" : \"x200\",\n \"imageUri\" : \"https://prod-inin-directory-service-profile.s3.amazonaws.com/b0ed52dc/22c4/4420/a533/0aa269fa2c88.jpg\"\n }, {\n \"resolution\" : \"x300\",\n \"imageUri\" : \"https://prod-inin-directory-service-profile.s3.amazonaws.com/6d4924c7/2eda/4479/a392/22ef3cc448e0.jpg\"\n }, {\n \"resolution\" : \"x400\",\n \"imageUri\" : \"https://prod-inin-directory-service-profile.s3.amazonaws.com/d9d8ce5d/b92f/46d3/a6ea/949d5bf85d38.jpg\"\n } ],\n \"version\" : 77,\n \"routingStatus\" : {\n \"status\" : \"IDLE\",\n \"startTime\" : \"2022-04-19T14:20:16.556Z\"\n },\n \"acdAutoAnswer\" : false,\n \"selfUri\" : \"/api/v2/users/8f306fc1-a069-4c15-bb6d-73ad24830e0f\"\n },\n \"ringNumber\" : 1,\n \"joined\" : true,\n \"memberBy\" : \"user\",\n \"routingStatus\" : {\n \"status\" : \"IDLE\",\n \"startTime\" : \"2022-04-19T14:20:16.556Z\"\n }\n } ],\n \"pageNumber\" : 1,\n \"pageSize\" : 25,\n \"firstUri\" : \"/api/v2/routing/queues/0501527b-4e3a-46b0-bcd2-44fbbf611df0/members?pageSize=25&pageNumber=1&joined=true&routingStatus=Idle\",\n \"selfUri\" : \"/api/v2/routing/queues/0501527b-4e3a-46b0-bcd2-44fbbf611df0/members?pageSize=25&pageNumber=1&joined=true&routingStatus=Idle\"\n}" }
Step 10:
{ "OnIdleAgentCount": 16 }
And this is the response for when the result is 1 (correct)!
{ "entities": [ { "id": "8f306fc1-a069-4c15-bb6d-73ad24830e0f", "name": "Servicios Argentina", "user": { "id": "8f306fc1-a069-4c15-bb6d-73ad24830e0f", "name": "Servicios Argentina", "division": { "id": "14378b4d-0181-4bc7-90a6-3c046a8c6b04", "name": "", "selfUri": "/api/v2/authorization/divisions/14378b4d-0181-4bc7-90a6-3c046a8c6b04" }, "chat": { "jabberId": "XXXXXXXXXXX@lat.orgspan.com" }, "email": "servicios-argentina@XXXXX.com", "primaryContactInfo": [ { "address": "servicios-argentina@XXXXX.com", "mediaType": "EMAIL", "type": "PRIMARY" } ], "addresses": [], "state": "active", "username": "servicios-argentina@XXXXX.com", "images": [ { "resolution": "x48", "imageUri": "https://prod-inin-directory-service-profile.s3.amazonaws.com/698b1716/d055/48ca/9e39/e01650864a3d.jpg" }, { "resolution": "x96", "imageUri": "https://prod-inin-directory-service-profile.s3.amazonaws.com/baf0904e/a728/4f4e/a466/c3bbe6372ac5.jpg" }, { "resolution": "x128", "imageUri": "https://prod-inin-directory-service-profile.s3.amazonaws.com/3c4c513a/8bf4/46fd/ae06/e9f32d4ab953.jpg" }, { "resolution": "x200", "imageUri": "https://prod-inin-directory-service-profile.s3.amazonaws.com/b0ed52dc/22c4/4420/a533/0aa269fa2c88.jpg" }, { "resolution": "x300", "imageUri": "https://prod-inin-directory-service-profile.s3.amazonaws.com/6d4924c7/2eda/4479/a392/22ef3cc448e0.jpg" }, { "resolution": "x400", "imageUri": "https://prod-inin-directory-service-profile.s3.amazonaws.com/d9d8ce5d/b92f/46d3/a6ea/949d5bf85d38.jpg" } ], "version": 77, "routingStatus": { "status": "IDLE", "startTime": "2022-04-19T14:20:16.556Z" }, "acdAutoAnswer": false, "selfUri": "/api/v2/users/8f306fc1-a069-4c15-bb6d-73ad24830e0f" }, "ringNumber": 1, "joined": true, "memberBy": "user", "routingStatus": { "status": "IDLE", "startTime": "2022-04-19T14:20:16.556Z" } } ], "pageNumber": 1, "pageSize": 25, "firstUri": "/api/v2/routing/queues/0501527b-4e3a-46b0-bcd2-44fbbf611df0/members?pageSize=25&pageNumber=1&joined=true&routingStatus=Idle", "selfUri": "/api/v2/routing/queues/0501527b-4e3a-46b0-bcd2-44fbbf611df0/members?pageSize=25&pageNumber=1&joined=true&routingStatus=Idle" }
Step 9:
{ "OnIdleAgentCount": "1", "rawResult": "{\n \"entities\" : [ {\n \"id\" : \"8f306fc1-a069-4c15-bb6d-73ad24830e0f\",\n \"name\" : \"Servicios Argentina\",\n \"user\" : {\n \"id\" : \"8f306fc1-a069-4c15-bb6d-73ad24830e0f\",\n \"name\" : \"Servicios Argentina\",\n \"division\" : {\n \"id\" : \"14378b4d-0181-4bc7-90a6-3c046a8c6b04\",\n \"name\" : \"\",\n \"selfUri\" : \"/api/v2/authorization/divisions/14378b4d-0181-4bc7-90a6-3c046a8c6b04\"\n },\n \"chat\" : {\n \"jabberId\" : \"61f457018f9c271bda5e49d9@lat.orgspan.com\"\n },\n \"email\" : \"servicios-argentina@xxxxx.com\",\n \"primaryContactInfo\" : [ {\n \"address\" : \"servicios-argentina@xxxxx.com\",\n \"mediaType\" : \"EMAIL\",\n \"type\" : \"PRIMARY\"\n } ],\n \"addresses\" : [ ],\n \"state\" : \"active\",\n \"username\" : \"servicios-argentina@xxxxx.com\",\n \"images\" : [ {\n \"resolution\" : \"x48\",\n \"imageUri\" : \"https://prod-inin-directory-service-profile.s3.amazonaws.com/698b1716/d055/48ca/9e39/e01650864a3d.jpg\"\n }, {\n \"resolution\" : \"x96\",\n \"imageUri\" : \"https://prod-inin-directory-service-profile.s3.amazonaws.com/baf0904e/a728/4f4e/a466/c3bbe6372ac5.jpg\"\n }, {\n \"resolution\" : \"x128\",\n \"imageUri\" : \"https://prod-inin-directory-service-profile.s3.amazonaws.com/3c4c513a/8bf4/46fd/ae06/e9f32d4ab953.jpg\"\n }, {\n \"resolution\" : \"x200\",\n \"imageUri\" : \"https://prod-inin-directory-service-profile.s3.amazonaws.com/b0ed52dc/22c4/4420/a533/0aa269fa2c88.jpg\"\n }, {\n \"resolution\" : \"x300\",\n \"imageUri\" : \"https://prod-inin-directory-service-profile.s3.amazonaws.com/6d4924c7/2eda/4479/a392/22ef3cc448e0.jpg\"\n }, {\n \"resolution\" : \"x400\",\n \"imageUri\" : \"https://prod-inin-directory-service-profile.s3.amazonaws.com/d9d8ce5d/b92f/46d3/a6ea/949d5bf85d38.jpg\"\n } ],\n \"version\" : 77,\n \"routingStatus\" : {\n \"status\" : \"IDLE\",\n \"startTime\" : \"2022-04-19T14:20:16.556Z\"\n },\n \"acdAutoAnswer\" : false,\n \"selfUri\" : \"/api/v2/users/8f306fc1-a069-4c15-bb6d-73ad24830e0f\"\n },\n \"ringNumber\" : 1,\n \"joined\" : true,\n \"memberBy\" : \"user\",\n \"routingStatus\" : {\n \"status\" : \"IDLE\",\n \"startTime\" : \"2022-04-19T14:20:16.556Z\"\n }\n } ],\n \"pageNumber\" : 1,\n \"pageSize\" : 25,\n \"firstUri\" : \"/api/v2/routing/queues/0501527b-4e3a-46b0-bcd2-44fbbf611df0/members?pageSize=25&pageNumber=1&joined=true&routingStatus=Idle\",\n \"selfUri\" : \"/api/v2/routing/queues/0501527b-4e3a-46b0-bcd2-44fbbf611df0/members?pageSize=25&pageNumber=1&joined=true&routingStatus=Idle\"\n}" }
Step 10:
{ "OnIdleAgentCount": 1 }
The actual responses are the same!
Screenshot:
So... Any known issue, should I go ahead and use it as is knowing that it ocasionally gives this response?, does it only happen with a single user?
Jerome.Saint-Marc | 2022-04-19 16:35:53 UTC | #2
Hello,
I think you are missing a $ in your translationMap. You should use $.entities.size()(I think $.entities.length() also works).
If I use .entities.size()like you, I can reproduce the error. If I use $.entities.size(), I did not have an incorrect count (1).
Regards,
Facundo_Nowicky | 2022-04-19 17:04:38 UTC | #3
Jerome.Saint-Marc, post:2, topic:14370
$.
G***t! it's correct the error is not reproduceable with the correction!!!! It's such a crazy error that it MOSTLY works with the missing symbol, almost like its running the "size" check on one of the sub-objects or something.
Thank you!
system | 2022-05-20 17:04:46 UTC | #4
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 14370