Retrieve multiple values from data action

We are running against a use case where it is required to retrieve multiple records as output from a data action. We are using the GetContactByPhoneNumber data action made available using the Microsoft Dynamics 365 data actions integration connector.

The phone number used as test number is attached to multiple contacts in MS Dynamics 365. When running a test, the data actions fails and gives an error message with status 400 ( "message": "Too many results matched criteria."). Is this the expected behavior as it only allows outputs containing one record? If so, can we modify the data action to allow multiple entries?

Returning an error for anything other than 1 result is expected behavior. Our goal was to make our stock integrations easy to use. Dealing with multiple results is fairly complicated in Architect, so we chose to not to return multiple results in our stock actions.

Here is a write-up of returning multiple results in salesforce actions:

That will probably get you going in the right direction. Feel free to post your configuration if you get hung up along the way.

1 Like

I have tried using the proposed solution by modifying the response code inside the data action. I have changed the successTemplate to now fetch multiple arrays:

{
"translationMap": {
"contact": ".value" }, "successTemplate": "{\"contacts\": {contact}}"
}

The data action is however not running successfully. Could be that I am missing a code. I am receiving an error code back status 400:

"code": "invalid.schema",
"message": "JSON failed schema validation for the following reasons: instance type (object) does not match any allowed primitive type (allowed: ["array"])"

This got resolved.

I have done some modification to the output contract/JSON output schema to allow array within an array.

1 Like

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