Skip to main content

Notifications

Announcements

No record found.

Power Platform integration forum
Answered

Custom Connector odd behavior

Posted on by 7
I've built a Custom Connector to parse a complex and large JSON payload. This custom connector accepts a JSON body and returns a JSON response.
I then built the Power Automate flow to get the JSON output from a Dataverse Query. The output that I am interested in is sent to the Custom Connector as outputs('DataFromDataverse')?['body']. So far so good.
 
 
PowerAutomate Code View snippet
PowerAutomate Code View snippet{  type: OpenApiConnection,  inputs: {    parameters: {      content-type: application/json,      body: @outputs('DataFromDataverse')?['body']    },
 
I then executed the flow once, sourced the JSON and proceeded to use the JSON to continue the C# code within the Custom Connector. The JSON generated by the above steps looks like so...
{  @odata.context: ,  value: [    {      @odata.type: #Microsoft.Dynamics.CRM.contact,    ......    }}
 
 
The value section has the Array that contains data from the expanded table. The issue is not with this Query or the format, this is a standard response.
 
When I use this JSON schema to complete the C# development and use the JSON as an Example to test out the Connector, the Custom Connector JSON Body has it's own syntax, which looks like below. I renamed the default /body/ to /raw/, since a body with another body was confusing.
 
{  raw: {body:{$:{  @odata.type: #Microsoft.Dynamics.CRM.contact: .....}
 
the actual JSON payload from Power Automate would in this case be treated as a String. I am able to consume the value of the /raw/ (or body) key and parse into JSON. 
 
The issue is not with parsing the JSON. The issue stems from the fact that the Custom Connector Test pane seems to enclose the actual JSON with a /body/ node and then also adds the /$/ node. This schema does not match with the schema that Power Automate uses. There seems to be an underlying behavior difference between developing this and consuming it. 
 
Kindly let me know if I am doing something wrong. How I keep the JSON input between Power Automate <> Custom Connector and the Custom Connector Test tab consistent
 
 
Thanks
 
Ben
  • Verified answer
    Custom Connector odd behavior
    I was able to work around the issue by matching the JSON expected by the Custom Connector by adding the additional elements in Power Automate
     
    {
      "body": {
        "$": @{outputs('GetRows')?['body']}
      }
    }
     

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,252 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,089 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Product updates

Dynamics 365 release plans