Data Action Errors

Hey, we are working on consuming a new API and are running into multiple issues.

Example Response (is there a better way to put code snippets here it seems to break the formatting):

{
  "personaResponse": [
    {
      "claimNumber": "123456-XX",
      "lossDate": "2021-01-02T05:00:00Z",
      "contact": {
        "id": "xx:1234",
        "roles": [
          "Insured",
          "Owner",
          "Claimant"
        ]
      }
    },
    {
      "claimNumber": "11111-YY",
      "lossDate": "2021-01-02T05:00:00Z",
      "contact": {
        "id": "yy:1212",
        "roles": [
          "Claimant"
        ]
      }
    }
  ]
}

We want the entire response, however when we try to define the schema and get Roles to work it gives an error:
Validate output schema can be flattened: Cannot flatten schemas with nested arrays!

So we tried manually assigning each variable instead of using "${rawResult}" and have this:
The first two personaResponses have * inside the []'s but it's turning that into italics FYI

{
  "translationMap": {
    "claimNumbers": "$.personaResponse[*].claimNumber",
    "lossDates": "$.personaResponse[*].lossDate",
    "contactIds": "$.personaResponse[*].contact.id",
    "roles1": "$.personaResponse[0].contact.roles",
    "roles2": "$.personaResponse[1].contact.roles",
    "roles3": "$.personaResponse[2].contact.roles",
    "roles4": "$.personaResponse[3].contact.roles",
    "roles5": "$.personaResponse[4].contact.roles"
  },
  "translationMapDefaults": {
    "claimNumbers": "[]",
    "lossDates": "[]",
    "contactIds": "[]",
    "roles1": "[]",
    "roles2": "[]",
    "roles3": "[]",
    "roles4": "[]",
    "roles5": "[]"
  },
  "successTemplate": "{ \"claimNumbers\": ${claimNumbers}, \"lossDates\": ${lossDates}, \"contactIds\": ${contactIds}, \"contactRoles\": [${roles1}, ${roles2}, ${roles3}, ${roles4}, ${roles5}] }"
}

With an output schema that looks like:
claimNumbers - Array (with a string child)
lossDates - Array (with a string child)
contactIds - Array (with a string child)
contactRoles - Array (with an array child that has a string child)

This does not give the nested array error (even though I thought it would), however when I test the data action I get a new weirder error:
"There was an error updating Data Action Name"
However if I click Save Draft this error does not pop up.

To make things even more confusing, if I uncheck "Flatten output" it actually returns exactly how I'd like it to and even rolls everything up into the correct output variables. However Flatten output defaults back to Checked any time I navigate away so I'd expect that it wont work if I publish it and test it in a flow.

The magic is to highlight the "code" and click on the </> button in the editor. That will do a much better job of displaying it.

Not sure where you're seeing </>

Nvm it's in the settings wheel for some weird reason...

Sorry, this got left on the back burner. Are you still having issues getting the action to behave the way you want it to?

--Jason

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