Using workPlanId or workPlanIdsPerWeek in schedule update causes error

Hello,

We have an established process for updating an existing schedule using Javascrip SDK, as described here: https://developer.genesys.cloud/useragentman/workforcemanagement/upload-update-schedule.

However we have ran into a problem once we tried adding either workPlanId or workPlanIdsPerWeek attributes to the uploaded schedule.

Here is the schedule we try to upload:

    "agentSchedules": [
        {
        "userId": "ac6c34d0-etc",
        "workPlanIdsPerWeek": ["5d871a31-12d7-4588-b97d-990ca76c40a3"],
        "shifts": [
            {
            "activities": [
                {
                "activityCodeId": "0",
                "startDate": "2022-11-24T23:30:00.000Z",
                "lengthMinutes": 90,
                "description": "",
                "paid": true
                },
                {
                "startDate": "2022-11-25T01:00:00.000Z",
                "lengthMinutes": 10,
                "description": "Break",
                "activityCodeId": "1",
                "paid": true
                },
                {
                "activityCodeId": "0",
                "startDate": "2022-11-25T01:10:00.000Z",
                "lengthMinutes": 170,
                "description": "",
                "paid": true
                },
                {
                "startDate": "2022-11-25T04:00:00.000Z",
                "lengthMinutes": 30,
                "description": "Meal",
                "activityCodeId": "2",
                "paid": false
                },
                {
                "activityCodeId": "0",
                "startDate": "2022-11-25T04:30:00.000Z",
                "lengthMinutes": 150,
                "description": "",
                "paid": true
                },
                {
                "startDate": "2022-11-25T07:00:00.000Z",
                "lengthMinutes": 10,
                "description": "Break",
                "activityCodeId": "1",
                "paid": true
                },
                {
                "activityCodeId": "0",
                "startDate": "2022-11-25T07:10:00.000Z",
                "lengthMinutes": 50,
                "description": "",
                "paid": true
                }
            ],
            "manuallyEdited": true,
            "id": "5"
            }
        ],
        "fullDayTimeOffMarkers": [],
        "metadata": { "version": 6 }
        }
    ],
    "metadata": { "version": 3 }
}

The operation id for the latest try was c5f9041e-2973-44a2-b034-4e8113011f90.

The notification then provides error details:

{
  "topicName": "v2.workforcemanagement.businessunits.0b726a7d-d87f-49e3-82fc-ef2811e15541.schedules",
  "version": "2",
  "eventBody": {
    "status": "Error",
    "operationId": "c5f9041e-2973-44a2-b034-4e8113011f90",
    "eventType": "Update"
  },
  "metadata": {
    "errorInfo": {
      "errorCode": "wfm.bad.json",
      "status": 400,
      "userMessage": "Cannot deserialize value of type `com.inin.wfm.api.dto.NullableListWrapper<java.lang.String>` from Array value (token `JsonToken.START_ARRAY`)\n at [Source: (org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream); line: 1, column: 90] (through reference chain: com.inin.wfm.api.dto.scheduling.bu.schedule.UpdateScheduleRequestApi[\"agentSchedules\"]->java.util.ArrayList[0]->com.inin.wfm.api.dto.scheduling.bu.schedule.AgentScheduleRequestApi[\"workPlanIdsPerWeek\"])",
      "userParams": [
        {
          "key": "uniqueErrorKey",
          "value": "wfm.badJson",
          "additionalProperties": {}
        }
      ]
    },
    "CorrelationId": "c7af5751-ac97-478f-987f-e8a8c697c35a"
  }
}

The error message is similar when using workPlanId:
"Cannot construct instance of com.inin.wfm.api.dto.PrimitiveWrapper (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('5d871a31-12d7-4588-b97d-990ca76c40a3')\n at [Source: (org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream); line: 1, column: 82] (through reference chain: com.inin.wfm.api.dto.scheduling.bu.schedule.UpdateScheduleRequestApi [\"agentSchedules\"]->java.util.ArrayList[0]-> com.inin.wfm.api.dto.scheduling.bu.schedule.AgentScheduleRequestApi[\"workPlanId\"])

Could you please help us with the following regarding the use of either workPlanId or workPlanIdsPerWeek :

  1. Any advice on how to fix the above error?
  2. Is there a way to indicate that schedule should be optimised per the specified work plan when uploading schedule, e.g. breaks should be moved to allocated locations? Can any other option be used for optimising shifts except following the scheduling runs APIs: postWorkforcemanagementBusinessunitWeekScheduleReschedule, getWorkforcemanagementBusinessunitSchedulingRunResult, then applying the suggested changes?

Thank you.

Regards,
Irena

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.