Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  Workitem Custom Field Throwing Error - POST API

    Posted 4 hours ago

    Hi, Using the API explorer "post /api/v2/taskmanagement/workitems": I'm able to add workitems correctly, but not with "customFields object".

    The request failed with response code: 422. Message: Invalid JSON schema instance. Details: Additional properties are not allowed ('service_group' was unexpected)

    I m using this thread as a reference https://community.genesys.com/discussion/workitem-custom-fields-not-able-to-be-added-post-workitem

    Below in my request Details

    {
       "name": "Workitem with custom attributes",
       "autoStatusTransition": true,
       "typeId": "96a8fee9-9b06-XXX0-9658-6d5353f4a632",
       "customFields" : {
        "service_group":"Text for custom attribute"
       }
    }

    Can someone please help here.


    #API/Integrations

    ------------------------------

    Hi, Using the API explorer "post /api/v2/taskmanagement/workitems": I'm able to add values correctly, after enabling Promode and putting details in the following format. Even though it throws error stating "The request failed with response code: 422. Message: Invalid JSON schema instance. Details: Additional properties are not allowed ('service_group' was unexpected)"  . I am following https://community.genesys.com/discussion/workitem-custom-fields-not-able-to-be-added-post-workitem conversation Thread, but still not able to do so. Can anyone help pls.


    {
       "name": "Workitem with custom attributes",
       "typeId": "96a8fee9-9b06-45a0-9658-6d535XXXXx2",
       "customFields" : {
        "service_group":"Text for custom attribute"
       }
    }


    ------------------------------


  • 2.  RE: Workitem Custom Field Throwing Error - POST API

    Posted 2 hours ago

    Hello Riddhi,  

    I am going to move this to the Developer Community as they should be best placed to help resolve the issue.  Have you set the schema as per the response in the link in your post?



    ------------------------------
    Sam Jillard
    Online Community Manager/Moderator
    Genesys - Employees
    ------------------------------



  • 3.  RE: Workitem Custom Field Throwing Error - POST API

    Posted 2 hours ago

    Hi @Samuel Jillard,

    I have followed all the steps as mentioned in the other thread.

    Activated Pro mode and added schema as per mentioned, still it is throwing error as mentioned above.



    ------------------------------
    Riddhi Singh
    .
    ------------------------------



  • 4.  RE: Workitem Custom Field Throwing Error - POST API

    Posted an hour ago

    Hi, @Riddhi Singh

    I would check two things here.

    First, make sure service_group is the exact Field Key from the custom attribute schema, not only the field name/display name. The workitem must reference a worktype that is linked to a schema containing that custom attribute. If the field key is different, Genesys will reject it as an unexpected property.

    Second, if you are testing from API Explorer, try using Pro Mode and paste the raw JSON directly. There are some known discussions around API Explorer handling the customFields object in a confusing way for workitems.

    The body should be something like this, using the exact field key from your schema:

    {
      "name": "Workitem with custom attributes",
      "autoStatusTransition": true,
      "typeId": "96a8fee9-9b06-XXX0-9658-6d5353f4a632",
      "customFields": {
        "your_exact_field_key": "Text for custom attribute"
      }
    }
    

    So I would validate the schema attached to the worktype, copy the exact custom attribute field key, and then retry the request using API Explorer Pro Mode or Postman.



    ------------------------------
    Arthur Pereira Reinoldes
    ------------------------------