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

Power Automate with Power Apps not working as expected

Hi All,

 

We are facing issue with power automate flow execution which is associated with Power Apps. 

 

We have a multi stage approval system which is built in Power Apps. Power Automate is used to send email notifications to the users, whenever there is submit, approve, reject action is performed in Power Apps along with all the details associated with approval record.

 

Sql tables are used to store workflow information, fetch next approver etc. There is a separate record for each workflow process which is updated whenever any workflow action is performed.

 

In Power Apps UI there is a Gallery, which displays these approval records as rows. In the same row, there is approve and reject button. 

 

We are sending workflow data as JSON to Power Automate flow, which then sends the notification based on the action.

 

Now the issue we are facing is, when user clicks approve for one record, the user receives email regarding different record.

 

Things we tried already: 

1. Remove and Add Power Automate definition from Power Apps.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

If you are updating the data source first, then I would expect the thisitem is changing based on the re-filtering of the data source after you do the update.  Have you considered saving the thisitem information as a context variable prior to the update and then passing that to the flow?



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Join me at 365 and PWR EduCon in Chicago
EduCon Chicago 2022

View solution in original post

6 REPLIES 6
Pstork1
Dual Super User
Dual Super User

Did you examine the JSON input for a recent run in Power Automate to verify that the right record is being passed to the flow?



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Join me at 365 and PWR EduCon in Chicago
EduCon Chicago 2022

@Pstork1

 

Thanks for the response. 

 

The json input to power automate itself is coming different. This is specifically happening when we use Approve button in the Power Apps gallery. 

 

We are using ThisItem to send workflow data to Power Automate. 

SidhharthM
Regular Visitor

We are using ThisItem to update the current record in SQL first, but the gallery view is filtered for current user once it is approved. I.E. record gets disappeared once database update happens. 

After this database update, we still use ThisItem to send the data to Power Automate by collecting all data in JSON.

Both database update and send email are placed on click of Approve button of the same record.

Is it the case that ThisItem variable gets changed when item is filtered out once db updated and when executing code for sending email, it collects information for different record?

 

If you are updating the data source first, then I would expect the thisitem is changing based on the re-filtering of the data source after you do the update.  Have you considered saving the thisitem information as a context variable prior to the update and then passing that to the flow?



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Join me at 365 and PWR EduCon in Chicago
EduCon Chicago 2022

@Pstork1 , thanks, we will try using context variable, and will update.

We changed the order of execution to Send Notifications via Power Automate first and then perform the database update.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (1,516)