Pass collection from flow to powerapp collection - Data comes from sharepoint search api

Highlighted
Contributor

I am looking forward to create a powerapp that will show data based on content type like all company wide annoucement or events

1. I have created a flow for this

1.PNG

I tried many ways returning the collection to powerapps, but it does not work

 

2.PNG

1 Reply
Highlighted

Respond to PowerApps block does not allow for passing arrays. The best way is to return string and parse it in PowerApps. Check below snapshots of my config:

 

Flow config:

 

flowsetup.jpg

In above the crucial part is the JSON scheme. You need to edit it a bit so it accept optional null value in fields. I paste my scheme below (i've bolded mentioned crucial part):

{
"type": "object",
"properties": {
"odata.metadata": {
"type": "string"
},
"ElapsedTime": {
"type": "integer"
},
"PrimaryQueryResult": {
"type": "object",
"properties": {
"CustomResults": {
"type": "array"
},
"QueryId": {
"type": "string"
},
"QueryRuleId": {
"type": "string"
},
"RefinementResults": {},
"RelevantResults": {
"type": "object",
"properties": {
"GroupTemplateId": {},
"ItemTemplateId": {},
"Properties": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Key": {
"type": "string"
},
"Value": {
"type": "string"
},
"ValueType": {
"type": "string"
}
},
"required": [
"Key",
"Value",
"ValueType"
]
}
},
"ResultTitle": {},
"ResultTitleUrl": {},
"RowCount": {
"type": "integer"
},
"Table": {
"type": "object",
"properties": {
"Rows": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Cells": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Key": {
"type": "string"
},
"Value": {
"type": [
"null",
"string"
]
},
"ValueType": {
"type": [
"null",
"string"
]
}
},
"required": [
"Key",
"Value",
"ValueType"
]
}
}
},
"required": [
"Cells"
]
}
}
}
},
"TotalRows": {
"type": "integer"
},
"TotalRowsIncludingDuplicates": {
"type": "integer"
}
}
},
"SpecialTermResults": {}
}
},
"Properties": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Key": {
"type": "string"
},
"Value": {
"type": "string"
},
"ValueType": {
"type": "string"
}
},
"required": [
"Key",
"Value",
"ValueType"
]
}
},
"SecondaryQueryResults": {
"type": "array"
},
"SpellingSuggestion": {
"type": "string"
},
"TriggeredRules": {
"type": "array"
}
}
}

 

 

Once successfully receive results in PowerApps you need to parse it so your gallery could display it. PowerApps config in my case looks like below:powerappssetup.jpg

 

And here are the result:

 powerappsresults.jpg