Legacy Dev Forum Posts

 View Only

Sign Up

Data Action response question

  • 1.  Data Action response question

    Posted 06-05-2025 18:40

    Duncan_Stewart | 2018-03-15 18:45:50 UTC | #1

    I have a new Data Action that takes PureCloud data and submits it to Salesforce. I initially defined the return value as a boolean, after which I changed it to a string (either 'Success' or 'Failed').

    The error I'm seeing indicates that it expects either 'true', 'false' or 'null'; not sure why it's insisting on those. I can change the return value, just wondering why.

    Output Contract: { "$schema": "http://json-schema.org/draft-04/schema#", "title": "System Log response", "description": "response", "type": "object", "properties": { "logCreated": { "description": "log created", "type": [ "string", "null" ] } } }

    Test Output: { "status": 400, "code": "invalid.schema", "message": "Unexpected exception occurred during schema validation. Error: Unrecognized token 'Success': was expecting ('true', 'false' or 'null')\n at [Source: (StringReader); line: 1, column: 15]", "messageParams": {}, "contextId": "63ddfe06-c911-4c8a-a0e5-503a240b3e8e", "details": [], "errors": [] }

    webservice return value is a String, as mentioned previously ^


    Duncan_Stewart | 2018-03-15 18:51:16 UTC | #2

    (Perhaps the change to the output contract wasn't actually saved, and was still expecting boolean - testing that theory...)


    Duncan_Stewart | 2018-03-15 20:22:08 UTC | #3

    Once the Output Contract is defined, even in draft form, is it locked for testing? I have gone back multiple times to change the "type" of the Output Contract property to "string", from "boolean", but the test keeps coming back with an error.

    At this point, perhaps it's better to start over, but for reference, this is my output contract, which I have saved, and then run the test. { "$schema": "http://json-schema.org/draft-04/schema#", "title": "System Log response", "description": "response", "type": "object", "properties": { "success": { "description": "log created", "type": [ "string", "null" ] } } }

    Test Result: { "status": 400, "code": "invalid.schema", "message": "JSON failed schema validation for the following reasons: instance type (boolean) does not match any allowed primitive type (allowed: [\"object\"])", "messageParams": {}, "contextId": "43890786-e9b3-41eb-a7ac-f1ba18dc8cb0", "details": [], "errors": [] }


    Duncan_Stewart | 2018-03-15 20:38:33 UTC | #4

    Again, apologies -- needed to create a Wrapper class to return the result. Oh JSON, you rascal..


    system | 2018-04-15 20:38:44 UTC | #5

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


    This post was migrated from the old Developer Forum.

    ref: 2614