Legacy Dev Forum Posts

 View Only

Sign Up

Data Action Response Assistance

  • 1.  Data Action Response Assistance

    Posted 06-05-2025 18:43

    H.Holloway | 2022-11-27 19:12:05 UTC | #1

    I am struggling to get the full response in my output and hope someone can assist.

    My output contract is

    { "title": "response", "type": "object", "properties": { "result": { "type": "string" } }, "additionalProperties": true }

    I am trying to get the full response in my result output I am not having any luck.

    The JSON response is

    { "ValidateAgreementResponse.ValidateAgreementResult": "<?xml version=\"1.0\" encoding=\"utf-8\"?><Agreement><Result>False</Result><AmountToPay>0.00</AmountToPay></Agreement>", "status": 200 }

    Here is the screenshot

    Here is the response template { "translationMap": {}, "translationMapDefaults": {}, "successTemplate": "${rawResult}" }

    Basically, I am trying to get the raw result in my output call result. Can anyone assist?

    Thanks.


    Jerome.Saint-Marc | 2022-11-28 13:38:00 UTC | #2

    Hello,

    The following Response Configuration will work:

    { "translationMap": { "agreementResult": "$['ValidateAgreementResponse.ValidateAgreementResult']" }, "translationMapDefaults": { "agreementResult": "\"\"" }, "successTemplate": "{ \"result\": ${agreementResult} }" }

    Regards,


    H.Holloway | 2022-11-28 13:55:17 UTC | #3

    Hi Jerome,

    Thank you, I got it working using

    { "translationMap": { "agreementResult": "$.FindAgreementsResponse.FindAgreementsResult" }, "translationMapDefaults": { "agreementResult": "\"\"" }, "successTemplate": "{ \"result\": ${agreementResult} }" }

    I found that I had to remove the brackets.

    I am still a little stuck and hoping you could help me.

    My response is as follows

    <?xml version="1.0" encoding="utf-8"?><Agreements><Agreement><AgreementNumber>G3542072</AgreementNumber><DateOfBirth>01/01/1990</DateOfBirth><IsInArrears>False</IsInArrears><AmountExpected>.00</AmountExpected><Collector /></Agreement></Agreements>

    How do I grab for example only the AgreementNumber which will be G3542072?

    Thank you


    Jerome.Saint-Marc | 2022-11-28 14:01:39 UTC | #4

    Hello,

    You might try with Velocity macros but it is not really meant to parse XML based string. Maybe something with split string function.

    I assume you might be using this Genesys Professional Services appfoundry application: https://appfoundry.genesys.com/filter/genesyscloud/listing/e75e1f0b-49f8-4608-92a0-4887f57546a5 I don't know it and never used it (it is a custom app made by Genesys PS) but I wonder if you have ways to extract some of the data from there. I mean parsing the XML result and extracting info in a JSON object structure.

    Regards,


    H.Holloway | 2022-11-28 14:05:02 UTC | #5

    Hi Jerome,

    I will try using split

    Yes, I am using the https://appfoundry.genesys.com/filter/genesyscloud/listing/e75e1f0b-49f8-4608-92a0-4887f57546a5 and it returns the XML string which I am struggling with.

    Harry


    Jason_Mathison | 2022-11-28 15:24:05 UTC | #6

    The replaceFirst method could make this a bit easier since it lets you use a regex.

    { "translationMap": {"result" : "result"}, "translationMapDefaults": {}, "successTemplate": "{ \"endResult\" : \"${result.replaceFirst('.<AgreementNumber>', \"\").replaceFirst('</AgreementNumber>.', \"\")}\" }" }

    For my testing I started with a response of

    { "result" : "BLAHBLAHLBLAH<AgreementNumber>G3542072</AgreementNumber>BLAHBLAHLBLAH" }

    with a final result of

    { "endResult": "G3542072" }


    H.Holloway | 2022-11-28 19:46:39 UTC | #7

    Jason_Mathison, post:6, topic:17382
    {
      "translationMap": {"result" : "result"},
      "translationMapDefaults": {},
      "successTemplate": "{ \"endResult\" : \"${result.replaceFirst('.*<AgreementNumber>', \"\").replaceFirst('</AgreementNumber>.*', \"\")}\" }"
    }

    Thank you much, this looks like it has done the trick and I am able to complete the task, thank you so much as i have been struggling with this for weeks and eventually had to reach out. There is so much that can be done with data actions, velocity macros etc but I am unsure how to make use of it all yet.


    system | 2022-12-29 19:46:49 UTC | #8

    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: 17382