A couple of days ago, I was helping a friend with a case in Microsoft Flow … So I thought this is a good time to write a new article that would be a reference for my friend, and hopefully others would find this useful if they came across the same issue.
The Case
Good to know…
This is How…
Solution 1
1: {
2: "Title":"JSON 123",
3: "Description":"JSON description"
4: }
Continue your Power Automate learning with the full day deep dive tutorial Building Solutions with Power Apps & Power Automate with Ahmad Najjar and Serge Luca at ESPC21 Online. Read more here.
Solution 2
The following solution is as clean and neat as the first one, however it involves another call to the SharePoint list which could be an overhead in some cases.
From the figure above, notice that we have added the “Get items” action after the trigger, and then we are filtering the action by ID to return only the correspondent item with the trigger (the added item). At this point, notice that we could have returned the “value” property available from the “Get items” action (which is JSON), however we want the JSON to look as clean and neat as solution 1. In the last action, we have added the “Select” action from the data operations action group, and then provided the “value” property as the field input form “From” (which is expecting a JSON object) and then we have mapped the properties we want to appear in the newly created JSON object (current action). The JSON output would look exactly as the one from solution 1.
Note: Title and description are from the “Get items” action, NOT from the trigger properties. This way the flow would work whether we are returning one item or multiple items. I hope this helps! Enjoy…
Reference: Najjar, A (2018). Building JSON Objects in Microsoft Flow. Available at: http://techcarpenter.blogspot.com/2018/02/building-json-objects-in-microsoft-flow.html [Accessed 6 November 2018]