cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SandAStairs
Advocate I
Advocate I

Power automate not returning values to Powerapps

Hi all,

 

I seem to be having a problem where some values are not getting returned to Powerapps from a Flow.

 

The flow takes values entered in the app and sends two rows to SQL Server, and then should return two id's generated by the database to the app, along with two constant values for error handling ("success" and a message).

 

In the app, the response is set as a variable

 

The constant values are coming through fine, however, the two SQL generated id's are not coming through, even though Power Automate says that it sent the values when I check the execution history.

 

Any idea what might be happening? 

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
SandAStairs
Advocate I
Advocate I

Okay, I've figured out what the issue was.

For whatever reason, there was a type conversion error, where the id's were trying to be passed as strings, when it was expecting an integer.

 

I changed the Respond to Powerapps step to send back strings instead of numbers, and now they're coming through fine.

 

Thanks for the help, and hope this is of use to someone else in the future

View solution in original post

4 REPLIES 4
bipinshan
Super User
Super User

Hi @SandAStairs ,

 

Would you be able to share the screenshot of Power Automate and Canvas App formula?

 

Ideally it should return all the values including constant values.  I Hope you have added Respond to Powerapps action and mapped all values as shown below

bipinshan_0-1640066642701.png

 

Please mark my answer verified if this is helpful!

Regards,

Bipin Kumar

Follow my Blog: https://xrmdynamicscrm.wordpress.com/

 

Please mark my answer verified if this is helpful!

Regards,

Bipin Kumar

Follow my Blog: https://xrmdynamicscrm.wordpress.com/

SandAStairs
Advocate I
Advocate I

Hi @bipinshan,

 

Here is the flow formula

 

save_site_flow.jpg

 

And this is the Powerapp formula which calls it

 

If(
    is_new_site,
    Set(response_variable, SaveSite2.Run(JSON({
        cust_id: data_card_cust_id.Update,
        site_address: data_card_site_address.Update,
        site_desc: data_card_site_desc.Update,
        site_asana_id: Blank(),
        site_adr_lot_no: data_card_site_adr_lot_no.Update,
        unit_type_name: data_card_unit_type_name.Update,
        site_adr_unit_no: data_card_site_adr_unit_no.Update,
        site_adr_street_no: data_card_site_adr_street_no.Update,
        site_adr_street_name: data_card_site_adr_street_name.Update,
        state_name: data_card_state_name.Update,
        suburb_name: data_card_suburb_name.Update,
        site_group_id: data_card_site_group_id.Update,
        site_created_at: data_card_site_created_at.Update,
        desc_name: data_card_desc_name.Update
    }))),
    Set(response_variable, UpdateSite.Run(JSON({
        site_id: selected_site_id,
        cust_id: data_card_cust_id.Update,
        site_address: data_card_site_address.Update,
        site_desc: data_card_site_desc.Update,
        site_asana_id: Blank(),
        site_adr_lot_no: data_card_site_adr_lot_no.Update,
        unit_type_name: data_card_unit_type_name.Update,
        site_adr_unit_no: data_card_site_adr_unit_no.Update,
        site_adr_street_no: data_card_site_adr_street_no.Update,
        site_adr_street_name: data_card_site_adr_street_name.Update,
        state_name: data_card_state_name.Update,
        suburb_name: data_card_suburb_name.Update,
        site_group_id: data_card_site_group_id.Update,
        site_created_at: data_card_site_created_at.Update
    }))); Refresh('quoting_system_db.site');
);
If(
    response_variable.response = "error",
    UpdateContext({show_error: true, error_message: response_variable.message}),
    Set(selected_site_id, Text(response_variable.site_id)); Navigate(scrViewSite)
)

 

All of the flow endings return to Powerapps

 

There are two different flows that get called based on the condition "is_new_site" (which is set to true), but both return the same values.

 

Hope that helps!

 

SandAStairs
Advocate I
Advocate I

Just to follow up with a couple more details, I ran a test with a simplified formula:

 

Set(response_variable,
    SaveSite2.Run(
        JSON(
            {
                cust_id: data_card_cust_id.Update,
                site_address: data_card_site_address.Update,
                site_desc: data_card_site_desc.Update,
                site_asana_id: Blank(),
                site_adr_lot_no: data_card_site_adr_lot_no.Update,
                unit_type_name: data_card_unit_type_name.Update,
                site_adr_unit_no: data_card_site_adr_unit_no.Update,
                site_adr_street_no: data_card_site_adr_street_no.Update,
                site_adr_street_name: data_card_site_adr_street_name.Update,
                state_name: data_card_state_name.Update,
                suburb_name: data_card_suburb_name.Update,
                site_group_id: data_card_site_group_id.Update,
                site_created_at: data_card_site_created_at.Update,
                desc_name: data_card_desc_name.Update
            }
        )
    )
);
Navigate(Screen1);

 

 Here is the output in Powerapps

save_site_flow_response.jpg

And the output body in Power automate

save_site_flow_response_2.jpg

SandAStairs
Advocate I
Advocate I

Okay, I've figured out what the issue was.

For whatever reason, there was a type conversion error, where the id's were trying to be passed as strings, when it was expecting an integer.

 

I changed the Respond to Powerapps step to send back strings instead of numbers, and now they're coming through fine.

 

Thanks for the help, and hope this is of use to someone else in the future

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,464)