Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  Error on simple update data table with data action

    Posted 05-02-2025 23:13

    Hello, 

    Hoping you can help me. Thanks in advance.


    I am trying to update a data table using a data action, but I'm getting always the same error and cannot find out why. 

    the json:

    {
      "name": "Update data table - Exported 2025-05-03 @ 3:59",
      "integrationType": "purecloud-data-actions",
      "actionType": "custom",
      "config": {
        "request": {
          "requestUrlTemplate": "/api/v2/flows/datatables/${input.datatableid}/rows/${input.issue}",
          "requestType": "PUT",
          "headers": {
            "Content-Type": "application/json",
            "UserAgent": "PureCloudIntegrations/1.0"
          },
          "requestTemplate": "{\n  \"prompt\": \"${input.prompt}\"\n}"
        },
        "response": {
          "translationMap": {},
          "translationMapDefaults": {},
          "successTemplate": "${rawResult}"
        }
      },
      "contract": {
        "input": {
          "inputSchema": {
            "title": "Update Data Table",
            "type": "object",
            "properties": {
              "datatableid": {
                "type": "string"
              },
              "issue": {
                "type": "string"
              },
              "prompt": {
                "type": "string"
              }
            },
            "additionalProperties": true
          }
        },
        "output": {
          "successSchema": {
            "title": "Response",
            "type": "object",
            "properties": {},
            "additionalProperties": true
          }
        }
      },
      "secure": false
    }

    When testing I get the error

    • REST call for action execute failed. Message: Request to backend service failed. Response from web service: {"message":"ValidationError: '' is too short\n\nFailed validating 'minLength' in schema['properties']['key']:\n {'$id': '/properties/key',\n 'displayOrder': 0,\n 'maxLength': 256,\n 'minLength': 1,\n 'title': 'issue',\n 'type': 'string'}\n\nOn instance['key']:\n ''","code":"flows.datatables.schema.exception","status":400,"messageParams":{},"contextId":"b232aef9-1a82-45de-99bd-79721f558a58","details":[],"errors":[]} [23726d69-7706-4b01-b3f8-3afa14b6f7f0]

    It's saying the "issue" value is empty, I think. But as you can see on the attachment, it's not!


    #DataActions

    ------------------------------
    Marco Silva
    ------------------------------


  • 2.  RE: Error on simple update data table with data action
    Best Answer

    Posted 05-05-2025 05:32

    Hello,

    You also need to set the "key" attribute in your request body (i.e. with the issue value).

    "requestTemplate": "{ \"key\": \"${input.issue}\", \"prompt\": \"${input.prompt}\" }"

    A comment, as I don't know if your table has other fields/columns (apart from key/issue and prompt): when you use the PUT endpoint, it will replace the full object. I mean that you have to provide all fields/columns from the table with their values, otherwise the missing fileds will be nulled out/emptied when you send the PUT.

    Regards,



    ------------------------------
    Jerome Saint-Marc
    Senior Development Support Engineer
    ------------------------------



  • 3.  RE: Error on simple update data table with data action

    Posted 05-05-2025 08:34

    Hello Jerome, that was it. Thanks for the help!



    ------------------------------
    Marco Silva
    ------------------------------