cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bryan-cognito
New Member

Problem with objects within arrays

We’re seeing what appears to be a problem in the way the Flow editor handles input for objects within arrays. In the example below, there is an “Items” array, which contains a “Text” field, as well as a “Name” field with “First”, “Last”, “Middle” etc. properties.

bryancognito_2-1628697509946.png

 

When we reload the Flow, it looks like this:

 

bryancognito_1-1628697497569.png

 

It appears the data is sent in the format as it appears in the image, which does not work on the backend. The data should be formatted as:

 

Items: {
  Text: [Text],
  Name: {
    First: [First Name],
    Last: [Last Name]
  }
}

 

 

If I "fix" the format of the data in the Flow editor, it then works when tested. But the Flow editor can't make sense of it when its reloaded, and it reverts to the initial view, but without any field values for the name field.

 

Are objects within arrays not supported, or is it possible we're doing something in our connector that's causing this?

 

The schema for the input (the relevant portion at least) looks like this:

 

{
    "type": "object",
    "properties": {
        "Items": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "Name": {
                        "type": "object",
                        "description": "Name",
                        "x-ms-summary": "Name",
                        "properties": {
                            "First": {
                                "type": "string",
                                "description": "First",
                                "x-ms-summary": "First"
                            },
                            "FirstAndLast": {
                                "type": "string",
                                "description": "First And Last",
                                "x-ms-summary": "First And Last",
                                "readOnly": true
                            },
                            "Last": {
                                "type": "string",
                                "description": "Last",
                                "x-ms-summary": "Last"
                            },
                            "Middle": {
                                "type": "string",
                                "description": "Middle",
                                "x-ms-summary": "Middle"
                            },
                            "MiddleInitial": {
                                "type": "string",
                                "description": "Middle Initial",
                                "x-ms-summary": "Middle Initial"
                            },
                            "Prefix": {
                                "type": "string",
                                "description": "Prefix",
                                "x-ms-summary": "Prefix"
                            },
                            "Suffix": {
                                "type": "string",
                                "description": "Suffix",
                                "x-ms-summary": "Suffix"
                            }
                        }
                    },
                    "Textbox": {
                        "type": "string",
                        "description": "Textbox",
                        "x-ms-summary": "Textbox"
                    }
                    "Id": {
                        "type": "string",
                        "description": "Id",
                        "x-ms-summary": "Id"
                    },
                    "ItemNumber": {
                        "type": "integer",
                        "description": "Item Number",
                        "x-ms-summary": "Item Number",
                        "readOnly": true
                    }
                }
            }
        }
    }
}

 

1 REPLY 1
Syndicate_Admin
Administrator
Administrator

As you can see the object is flattened. Just use the flat objects (i.e. don't use Name structure inside array). Update your API to take this as input. If API modification isn't possible please use a custom code for transformation.

https://docs.microsoft.com/en-us/connectors/custom-connectors/write-code

If this reply answers your question or solves your issue, please ACCEPT AS SOLUTION ☑️. If you find this reply helpful, please consider giving it a LIKE 👍.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Users online (4,460)