Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  API request for creating Work Item with custom attributes

    Posted 20 days ago

    Has anyone used the APIs to create work items with custom attributes?

    The documentation (https://developer.genesys.cloud/commdigital/taskmanagement/task-management-custom-attributes) shows they are added as a key value pair:
    {

     "name": "Workitem with custom attributes", 

     "customFields" : { "custom_attribute_text":"Text for custom attribute", "custom_attribute_2_integer":100 }

     }

    But when using the API explorer (create, patch or bulk add work items), custom attributes are added as a key object pair:
    {
      "name": "dumm",
      "customFields": {
        "custom_key": {
          "some_key": "some_value"
        }
      }
    }

    It's not clear how to format the object. Any ideas? Or is this a bug in the API explorer?


    #PlatformAPI

    ------------------------------
    Stuart Gielen
    IT Lead
    ------------------------------


  • 2.  RE: API request for creating Work Item with custom attributes

    Posted 20 days ago

    Hi Stuart

    Seems this is a known issues as I found threads in the community - https://community.genesys.com/discussion/post-workitem

    https://community.genesys.com/discussion/workitem-custom-fields-not-able-to-be-added-post-workitem.

    The main suggestion was to make use of Pro mode and create your JSON data directly in the text area.

    Regards



    ------------------------------
    Stephan Taljaard
    EMBEDIT s.r.o
    ------------------------------



  • 3.  RE: API request for creating Work Item with custom attributes

    Posted 16 days ago

    Thanks Stephan! I wasn't aware of the pro mode to override the schema enforcement. I can now successfully use the documented format to create workitems



    ------------------------------
    Stuart Gielen
    IT Lead
    ------------------------------



  • 4.  RE: API request for creating Work Item with custom attributes

    Posted 19 days ago

    Olá!

    Nesse exemplo utilizava a API para carregar o resumo do copiloto nos atributos, quando ele era localizal apenas por API:


    {
      "name": "Update the attributes copilot",
      "integrationType": "purecloud-data-actions",
      "actionType": "custom",
      "config": {
        "request": {
          "requestUrlTemplate": "/api/v2/conversations/${input.conversationId}/participants/${input.participantId}/attributes",
          "requestType": "PATCH",
          "headers": {
            "Content-Type": "application/json"
          },
          "requestTemplate": "{\n   \"attributes\": \n{\n\"resumo\":\"${input.resumo}\",\n\"followup\": \"${input.followup}\",\n\"resolution\": \"${input.resolution}\",\n\"tabulacaoSugerida\": \"${input.tabulacaoSugerida}\"\n}\n}"
        },
        "response": {
          "translationMap": {},
          "translationMapDefaults": {},
          "successTemplate": "${rawResult}"
        }
      },
      "contract": {
        "input": {
          "inputSchema": {
            "type": "object",
            "properties": {
              "conversationId": {
                "type": "string"
              },
              "participantId": {
                "type": "string"
              },
              "resumo": {
                "default": "desconexaoDuplicidadeWhatsApp",
                "type": "string"
              },
              "followup": {
                "type": "string"
              },
              "resolution": {
                "type": "string"
              },
              "tabulacaoSugerida": {
                "type": "string"
              }
            },
            "additionalProperties": true
          }
        },
        "output": {
          "successSchema": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          }
        }
      },
      "secure": false
    }



    ------------------------------
    Augusto Aranha
    Gerente de Desenvolvimento de Sistemas e Planejamento
    ------------------------------



  • 5.  RE: API request for creating Work Item with custom attributes

    Posted 13 days ago

    Obrigado!



    ------------------------------
    Augusto Aranha
    Gerente de Desenvolvimento de Sistemas e Planejamento
    ------------------------------



  • 6.  RE: API request for creating Work Item with custom attributes

    Posted 19 days ago

    In the API explorer if you add it into the window directly this format is working. Use the pro mode. 

    {

      "name": "Soknad",

      "priority": 300,

      "workbinId": "a54de182-7e57-4eb1-a71c-3df2a3de86be",

      "typeId": "bb857580-2f8f-491f-8d1b-72f103ff57c9",

      "customFields": {

       

          "cso_so_name_text": "Eystein",

    "cso_duedate_date":"2025-09-29",

    "cso_url_lookup_url":"https://www.vg.no"

       

      }

    }



    ------------------------------
    Eystein Kylland
    Systemutvikler Genesys Applikasjonsspesialist
    ------------------------------



  • 7.  RE: API request for creating Work Item with custom attributes

    Posted 16 days ago

    Takk Eystein, I wasn't aware of the pro mode. I can use the documented format now



    ------------------------------
    Stuart Gielen
    IT Lead
    ------------------------------



  • 8.  RE: API request for creating Work Item with custom attributes

    Posted 18 days ago

    Another option would be to use Postman or some other REST client. I have a Postman workspace I'd be happy to share with you that has all of the API calls as requests.



    ------------------------------
    Steve Park
    Senior Principal Professional Services - Digital
    ------------------------------



  • 9.  RE: API request for creating Work Item with custom attributes

    Posted 13 days ago

    Hi Stuart,

    I tested something very similar recently and I believe the confusion comes mainly from the API Explorer schema rendering, not from the actual API contract itself.

    The examples shared by Eystein align with what worked for us as well: customFields behaves as a flat key/value dictionary, not as nested objects.

    So this structure is valid:

    {
      "name": "Soknad",
      "priority": 300,
      "workbinId": "a54de182-7e57-4eb1-a71c-3df2a3de86be",
      "typeId": "bb857580-2f8f-491f-8d1b-72f103ff57c9",
      "customFields": {
        "cso_so_name_text": "Eystein",
        "cso_duedate_date": "2025-09-29",
        "cso_url_lookup_url": "https://www.vg.no"
      }
    }
    

    What seems misleading is that the API Explorer auto-generates a generic object schema like:

    "custom_key": {
      "some_key": "some_value"
    }
    

    but the backend itself expects:

    <string, primitive>
    

    instead of:

    <string, object>
    

    I also strongly recommend using Pro Mode in API Explorer or testing through Postman/SDK because the standard Explorer UI sometimes injects incorrect example payloads for dynamic objects/maps.

    One important production detail:
    the custom field internal name and datatype must match exactly what was configured in Task Management.

    For example:

    *_text → string
    *_integer → numeric
    *_date → ISO date
    *_url → URL/string
    If the type mismatches, behavior can become inconsistent depending on the endpoint:

    validation errors
    silent field drops
    partial updates
    Another thing we noticed:
    PATCH operations usually behave more predictably than bulk operations when testing new custom fields, especially while validating mappings and field names.

    So overall, I would classify this more as an API Explorer/example inconsistency rather than an actual limitation in Workitem custom attributes support.



    ------------------------------
    Gabriel Garcia
    NA
    ------------------------------