Creating WFM planning group with API

Hi,
I am trying to create a lot of planning groups with the Java Platform SDK using endpoint /api/v2/workforcemanagement/businessunits/{businessUnitId}/planninggroups

However, I can't figure out what to set for the sourcePlanningGroup id field. I am trying to add a planning group so I definitely have no ID for planning group at this point but it is a mandatory field. I tried to set different values but I always got "Entity not found" error response.

Any thoughts on the ID expected with this API endpoint?
thansk,
Zsolt

Hi Zsolt,

Have you tried leaving out the sourcePlanningGroup property? The API docs can sometimes be unhelpful and include properties that may not be necessary or possible to set in a request.

hi Ronan,
I played a bit with the Java SDK version and I was able to make it work, maybe not the most optimal solution but it definitely works:

  1. add a planning group without any route path
  2. as part of step one you can get a planning group id
  3. update the planning group with the above id adding the require route path(s)

Note that there is an extra twist in this, this process doesnt work on the UI because the user interface rejects adding a planning group without a route path :slight_smile:

Zsolt

1 Like

Hi @beliczazsolt -

I apologize for the lack of clarity in the documentation, I will be making a change today to correct that.

To answer your question: sourcePlanningGroup is there in case you are "stealing" a route path from another planning group, as route paths are required to be unique within a business unit. If you attempt to specify a route path that already exists in another planning group and don't supply that planning group in the request then the request will be rejected.

If you are not "stealing" a route path from another planning group, then you may omit "sourcePlanningGroup" entirely (note that it is not marked as required on the route documentation here.

Note that if you do "steal" a route path from another planning group (and supply that planning group's ID) then the other planning group will be modified by this request to remove that route path.

Thanks, it makes more sense knowing the background of it. It would be even more logical to be able to not just "steal" but add brand new route paths as part of the planning group creation but other then that the above process works well, just need to do 2 API calls.
Zsolt

As mentioned there's no need to make two API calls. If you're not adding a route path already configured for another planning group then you can leave out the source planning group property.

You can add brand new route paths in this call - they just have to either be unique within the business unit or include the planning group where they currently reside so they can be moved. A route path is a container that references actual queues/skills/languages/etc so it is truly important that they not be duplicated for scheduling purposes.

1 Like

Ah, I see your point now., thanks for clarifying. I will modify the logic to go with just a single API call.
Zsolt

1 Like

I wanted to give an update that the developer center now has updated documentation for the sourcePlanningGroup field.

Here's the link to the route in question again. Hopefully that'll make things clearer going forward.

POST /api/v2/workforcemanagement/businessunits/{businessUnitId}/planninggroups

Thanks, it should help others using this API. My code works well too now that I understand what sourcePlanningGroup is for.
Zsolt

1 Like

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