Genesys Data Actions - Store a JSON Object Response from a Data Action of type GET and pass back the JSON object as an input parameter to another Data Action of type POST. Both Data Actions will be called from Architect IVR Flow

We have already completed the SAP integration. The SAP Endpoints are also accessible from Genesys.

Ask : We are looking to run two Data Actions ( Acquire a Json object from one Data action of method type GET and pass it to the next Data Action of type POST, both Data Action will be called from Architect Flow ).

Detailed Explanation
Step 1) Get Request :
When we perform a Get, we receive a JSON response like the below one
**Sample Response**

 {
                  "d": {
                "results": [
                  {
                    "__metadata": {
                      "id": "Something",
                      "uri": "Something",
                      "type": "Something"
                    },
                    "DocumentNumber": "SomeDocumentNumber",
                    "ProfileId": "",
                    "RepetitionItem": "000",
                    "Item": "0001",
                    "SubItem": "000",
                    "BusinessPartner": "SomeBPNumber",
                    "ContractAccountNumber": "SomeCANumber",
                    "Text": "",
                    "Currency": "CAD",
                    "NetDate": "/Date(1673481600000)/",
                    "Amount": "307.00",
                    "NetDateString": "2023-01-12T00:00:00"
                  },
                  {
                    "__metadata": {
                      "id": "Something",
                      "uri": "Something",
                      "type": "Something"
                    },
                    "DocumentNumber": "SomeDocumentNumber",
                    "ProfileId": "",
                    "RepetitionItem": "000",
                    "Item": "0003",
                    "SubItem": "000",
                    "BusinessPartner": "SomeBPNumber",
                    "ContractAccountNumber": "SomeCANumber",
                    "Text": "",
                    "Currency": "CAD",
                    "NetDate": "/Date(1673481600000)/",
                    "Amount": "1330.21",
                    "NetDateString": "2023-01-12T00:00:00"
                  }
                ]
                  }
                }

We are interested in retrieving the JSON under "d.results", we need to store the Array
The Output will be an Array of JSON Object.
Note : The size of the Results ( total number of Objects returned can go on unto 400 items )
There is no fixed Size for Results.

Help us to frame an Output contract, so that the Results of any size can be stored in ( Architect Flow ).

Sample Ouput we need to be stored in Architect.

Question 1: What Should be output Contract in Data Action ?
Question 2: What Data Type needs to used in Architect for storing the Output

Step 2: POST Request :

Request Body Template
{
"ProfileId" : "",
"ContractAccountNumber" : "SomeCANumber",
"BusinessPartner" : "SomeBPNumber",
"StartDate" : "2023-01-17T00:00:00",
"DocumentDate" : null,
"PostingDate" : null,
"DocumentType" : "IP",
"InstallmentAmount" : "0.00",
"InstallmentPlanType" : "0019 ",
"ChargeAmount" : "0.00",
"RemainingAmount" : " ",
"Simulation" : true,
"Category" : "19 ",
"Term" : "6",
"Cycle" : "MO",
"OpenItems" : [
// Here the Output obtained in Step 1 Should be used
    {
      "__metadata": {
        "id": "Something",
        "uri": "Something",
        "type": "Something"
      },
      "DocumentNumber": "SomeDocumentNumber",
      "ProfileId": "",
      "RepetitionItem": "000",
      "Item": "0001",
      "SubItem": "000",
      "BusinessPartner": "SomeBPNumber",
      "ContractAccountNumber": "SomeCANumber",
      "Text": "",
      "Currency": "CAD",
      "NetDate": "/Date(1673481600000)/",
      "Amount": "307.00",
      "NetDateString": "2023-01-12T00:00:00"
    },
    {
      "__metadata": {
        "id": "Something",
        "uri": "Something",
        "type": "Something"
      },
      "DocumentNumber": "SomeDocumentNumber",
      "ProfileId": "",
      "RepetitionItem": "000",
      "Item": "0003",
      "SubItem": "000",
      "BusinessPartner": "SomeBPNumber",
      "ContractAccountNumber": "SomeCANumber",
      "Text": "",
      "Currency": "CAD",
      "NetDate": "/Date(1673481600000)/",
      "Amount": "1330.21",
      "NetDateString": "2023-01-12T00:00:00"
    }
  ]  }

Question 3 :
Is there is a way to pass the JSON object in the POST as an Input parameter.
The Input Parameter needs to be sent from Architect Flow.

I get the following error, when trying to use the Input type as Object.

"Failed Validation of contract.input.inputSchema as a simple properties schema.
Must be an Object with properties and no sub-objects.
JSON failed schema validation for the following reasons: Schema: # @/properties/properties/patternProperties/^[a-zA-Z][a-zA-Z0-9_-]*$/properties/type.
Error location: /properties/Results/type. instance value ("object") not found in enum (possible values: ["boolean","integer","null","number","string"])"

Hi Tamilalaghan,

Architect currently cannot handle JSON blobs, so to get the blob of JSON out to architect it would have to be escaped into a string with the esc.json tool:

You could then hold that string in architect and pass it into your next data action. We currently don't have an "unescape json" macro, so you might have to do that with velocity like in this post:

Longer term I would suggest watching this accepted idea, as it should clean all of this up for you:
https://genesyscloud.ideas.aha.io/ideas/SSA-I-141

--Jason

Note that idea https://genesyscloud.ideas.aha.io/ideas/SSA-I-141 has changed state:

  • ADMIN RESPONSE

Jan 23, 2023

Development for this features has wrapped up, and we're now in the final stages of QA testing. GA is currently scheduled for February.

--Jason

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