cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gorilla_8
Impactful Individual
Impactful Individual

HTTP REQUEST - GET ITEM AND RETURN POWERAPPS

Hey guys, I need to GET a field named "CtrSAP" on a project site, but I never worked with this before.

 

Someone can help me out how I get the field and show a gallery on PowerApps, 

 

If you wanna know the app works on collection...

 

Here the flow I am trying to do...

 

http_notresposnse.png

 

And I don't know it the code on "URI" is correct: 

_api/ProjectData/Tarefas?select=CTrSAP

 

I need to get the field "CTrSAP" to put on a label in PowerApps...

 

Thanks for the help!

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Gorilla_8 ,

Could you please share a bit more about your scenario?

Do you want to get the "CtrSAP" field value of a specific item from your SP List using flow and then return it back to your app?

Or get the "CtrSAP" field values from all records in your SP List, and then return the "CtrSAP" field value collection back to your app?

 

If you wan to get the "CtrSAP" field value of a specific item from your SP List using flow and then return it back to your app, I think it is not necessary to add a "Send an HTTP request to SharePoint" action, instead, you should configure your flow as below:

5.JPG

Then within your canvas app, you should execute the following formula:

Set(
    returnedValue, 
    'FlowName'.Run("Type specific List Item ID here").department   // department represents the Output parameter specified in your "Respond to a PowerApp or flow" action
)

 

If you want to get "CtrSAP" field values from all records in your SP List, and then return the "CtrSAP" field value collection back to your app, I think there is something wrong with your flow's configuration. I have made a test on my side, please take a try with the following flow's configuration:

7.JPGWithin the "Send an HTTP request to SharePoint" action, Uri field set to following:

_api/web/lists('c548e6fb-4d82-4b26-81d4-1dc79415cfef')/items?$select=Title

on your side, you should type:

_api/web/lists('Your SP List Guid')/items?$select=CtrSAP

 

Within the "Response" action, Body field set to following:

body('Send_an_HTTP_request_to_SharePoint')?['d']?['results']

"Response Body JSON Schema" field set to following:

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "Title": {
                "type": "string"
            }
        },
        "required": [
            "Title"
        ]
    }
}

On your side, you should type:

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "CtrSAP": {
                "type": "string"
            }
        },
        "required": [
            "CtrSAP"
        ]
    }
}

Note: I assume that the "CtrSAP" field is Text type column in your SP List

Within your canvas app, configure it as below:

8.JPG

 

9.JPG

Note: For getting the List GUID value, you could go to the List Settings of your SP List, then the GUID value would be shown up as below:

6.JPG

 

More details about returning table value from a flow back to an app, please check the following blog:

https://powerapps.microsoft.com/en-us/blog/return-an-array-from-flow-to-powerapps-response-method/

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-xida-msft
Community Support
Community Support

Hi @Gorilla_8 ,

Could you please share a bit more about your scenario?

Do you want to get the "CtrSAP" field value of a specific item from your SP List using flow and then return it back to your app?

Or get the "CtrSAP" field values from all records in your SP List, and then return the "CtrSAP" field value collection back to your app?

 

If you wan to get the "CtrSAP" field value of a specific item from your SP List using flow and then return it back to your app, I think it is not necessary to add a "Send an HTTP request to SharePoint" action, instead, you should configure your flow as below:

5.JPG

Then within your canvas app, you should execute the following formula:

Set(
    returnedValue, 
    'FlowName'.Run("Type specific List Item ID here").department   // department represents the Output parameter specified in your "Respond to a PowerApp or flow" action
)

 

If you want to get "CtrSAP" field values from all records in your SP List, and then return the "CtrSAP" field value collection back to your app, I think there is something wrong with your flow's configuration. I have made a test on my side, please take a try with the following flow's configuration:

7.JPGWithin the "Send an HTTP request to SharePoint" action, Uri field set to following:

_api/web/lists('c548e6fb-4d82-4b26-81d4-1dc79415cfef')/items?$select=Title

on your side, you should type:

_api/web/lists('Your SP List Guid')/items?$select=CtrSAP

 

Within the "Response" action, Body field set to following:

body('Send_an_HTTP_request_to_SharePoint')?['d']?['results']

"Response Body JSON Schema" field set to following:

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "Title": {
                "type": "string"
            }
        },
        "required": [
            "Title"
        ]
    }
}

On your side, you should type:

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "CtrSAP": {
                "type": "string"
            }
        },
        "required": [
            "CtrSAP"
        ]
    }
}

Note: I assume that the "CtrSAP" field is Text type column in your SP List

Within your canvas app, configure it as below:

8.JPG

 

9.JPG

Note: For getting the List GUID value, you could go to the List Settings of your SP List, then the GUID value would be shown up as below:

6.JPG

 

More details about returning table value from a flow back to an app, please check the following blog:

https://powerapps.microsoft.com/en-us/blog/return-an-array-from-flow-to-powerapps-response-method/

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Gorilla_8
Impactful Individual
Impactful Individual

@v-xida-msft Thank you very much for the help! 

 

Yes, I wanna get the "CtrSAP" field values from all records in your SP List (PROJECT LIST), and then return the "CtrSAP" field value collection back to my gallery collection.

 

I try to make this code simple, but on my PowerApps didn't recognize the "FLOW"

 

See as below:

 

I make this code OnSelect

 

ClearCollect(CTRPSA_Collection;'Cópiade-GetTasksWithCustomFields'.Run())

 

powerapps_1.png

 

On the gallery ITEMS:

 

CTRPSA_Collection

 

the_collection_powerapps.png

 

But, on the flow, I get the same error, over and over:

 

first_piece_flow_run.png

second_piece_flow_run.png

 

He gets the code on-field CTrSAP, like this:

 

{
  "d": {
    "results": [
      {
        "__metadata": {
          "id": "https://minhaticloud.sharepoint.com/sites/PRIME/_api/ProjectData/Tarefas(IddeProjeto=guid'5a2ce245-bafc-e911-930c-204747fc83d9',IddeTarefa=guid'620a9e57-d306-ea11-8282-204747fc83d9')",
          "uri": "https://minhaticloud.sharepoint.com/sites/PRIME/_api/ProjectData/Tarefas(IddeProjeto=guid'5a2ce245-bafc-e911-930c-204747fc83d9',IddeTarefa=guid'620a9e57-d306-ea11-8282-204747fc83d9')",
          "type": "ReportingData.Tarefa"
        },
        "CTrSAP": "AE-07   "
      }....

 

The first result was: AE-07, but there are more I wanna show within the gallery, recognizing the ID's.

 

But, I appreciate your help so far! Thank you very much! @v-xida-msft 

 

 

 

 

 

Hi @Gorilla_8 ,

Have you added the flow connection into your canvas app?

 

Please make sure you have added the flow connection into your canvas app already. More details about firing a flow from an app, please check the following article or video:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/using-logic-flows

https://www.youtube.com/watch?v=1wl9AtxWdkg

 

Within the "Response" action, please make sure the Body field is set to following expression:

body('Send_an_HTTP_request_to_SharePoint')?['d']?['results']

set the "Response Body JSON Schema" field to following JSON Schema:

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "CTrSAP": {
                "type": "string"
            }
        },
        "required": [
            "CTrSAP"
        ]
    }
}

Note: Please type proper field name "CTrSAP" within above JSON Schema (under properties and required property). The field name within above JSON Schema is Case Sensitive, so please make sure type correct field name within above JSON Schema.

 

You could also consider check the following blog for returning table value back to canvas app:

https://powerapps.microsoft.com/en-us/blog/return-an-array-from-flow-to-powerapps-response-method/

 

Please consider check above blog step by step, then apply it to your scenario, then save your flow. Within your canvas app, remove the flow connection, then re-create a new flow connection in your app, check if the issue is solved.

 

If you still have issue with this scenario, I think a quick call in Teams would help your scenario better.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Gorilla_8
Impactful Individual
Impactful Individual

@v-xida-msft Thanks for the help!

 

I get the error, I do everything right, but I just need to refresh the flow on PowerApps, and then he recognizes the field I wanna show.

 

Thank you so much for the help, also your time and your knowledge! 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,093)