cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AdrianPeterson
Regular Visitor

Sending collected gallery items via JSON to PowerAutomate (The JSON function cannot serialize tables/objects with a nested property)

Hi Experts,

 

Tried solving this by myself but could really appreciate a steer in right direction.

 

I've created gallery that gets its data from a table (source D365 Fin & Ops). I've then added highlighted field - Transit Qty. The field is an input.

AdrianPeterson_0-1618490286973.png

 

I've then created button that sends all items from the filtered gallery to a collection. All of this works fine up to this point.

 

I've then added an action to the above button that sends the collection to PowerAutomate flow. I had to use JSONFormat to get rid of unsupported types as I was getting the "JSON function cannot serialize tables/objects with a nested property" errors.

AdrianPeterson_1-1618490515509.png

 

Flow successfuly ran but I could only see limited data in the flow. As in the picture below, only the table data like Item number or Qty has been sent to the flow. My question is - how can I include gallery created fields like Transit Qty in the JSON and send them to the flow?

 

AdrianPeterson_2-1618490692679.png

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@AdrianPeterson 

You will need to shape the data from the Gallery to give you what you want.  The AllItems property of the gallery will give you all of the rows of the gallery...data AND controls.

 

With({_jsonData:    
    ShowColumns(
        AddColumns(yourGallery.AllItems, 
            "otherData", textinputx.Text
        ), 
        "otherData", "datacolumn1", "datacolumn2", etc..
    )},

    TransitLinesApp.Run(JSON(_jsonData, IndentFour & IngnoreBinaryData))
)

 

So in the above, we are adding a column that contains the text value of a textinput that might be in the gallery and then the result of that, we essentially drop all the other columns and only "show" the columns listed in the ShowColumns function.  Our end result is a table that has the column and value for the control in the row and the columns that you want to pass along in the JSON.

Finally all of this is just sent to the JSON function and the text results of that are sent to the flow.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

3 REPLIES 3
RandyHayes
Super User III
Super User III

@AdrianPeterson 

You will need to shape the data from the Gallery to give you what you want.  The AllItems property of the gallery will give you all of the rows of the gallery...data AND controls.

 

With({_jsonData:    
    ShowColumns(
        AddColumns(yourGallery.AllItems, 
            "otherData", textinputx.Text
        ), 
        "otherData", "datacolumn1", "datacolumn2", etc..
    )},

    TransitLinesApp.Run(JSON(_jsonData, IndentFour & IngnoreBinaryData))
)

 

So in the above, we are adding a column that contains the text value of a textinput that might be in the gallery and then the result of that, we essentially drop all the other columns and only "show" the columns listed in the ShowColumns function.  Our end result is a table that has the column and value for the control in the row and the columns that you want to pass along in the JSON.

Finally all of this is just sent to the JSON function and the text results of that are sent to the flow.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

Hi @RandyHayes I have to say I appreciate your reply due to two reasons: one is that suggested solution worked beatifully (I can see that control has been added to the data and is visible in the output).

 

Second is that, being relatively new to power apps, you've introduced me to alternative approach that will surely simplify a lot of things going forward (formula = with). This advice is definiately in line with your bio. Thanks for the help!

 

AdrianPeterson_0-1618561196519.png

 

RandyHayes
Super User III
Super User III

@AdrianPeterson 

Excellent!  Yes, keep it super simple!!  And, the With function and the Coalesce function (which I don't see a lot use) will immensely increase your productivity and simplicity.  Those are two functions (among many) that are my go-to's.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (64,619)