cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
elaaadani
Helper V
Helper V

Return value from power automate to powerapps with bar scanner qr trigger

Good afternoon, I am creating an app that scans a QR code. This is my trigger in power automate. I have problems when I want to pass the variables created in power automate to power apps.
I am following this logic

FlowName.Run().valuefromflow


The problem I have is that it doesn't recognize the variable

elaaadani_0-1660860364416.png

From flow I have this

elaaadani_1-1660860393668.png


Please help, thank you very much

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@elaaadani 

No it is not necessary and you should avoid using variables as much as possible in your app.  There are times for them, but excessive variables is frowned upon (even in the Microsoft docs) and it will make your app more difficult to manage, design and troubleshoot.

 

In your case, you will need one variable.  But think record...not just text.

Your flow is returning a record, not a single text.  You are then calling the flow over and over again with the same value to then get each element of your return record.  This is excessive and requiring more flow runs than you need.

 

As mentioned, the only thing you need is the one variable and one call to your flow.

Set(varReturn, PruebaPowerapps.Run(BarcodeScanner1.Value))

 

That variable (varReturn) is going to contain the record returned from your flow.

So, you can reference any column of the record anywhere in your app.

 

varReturn.rut

varReturn.nombre

varReturn.mesa

etc...

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

9 REPLIES 9
RandyHayes
Super User
Super User

@elaaadani 

It appears your issue is that you are putting that formula in a Property, not in a Behavioral Action.

Where are you putting that formula?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
elaaadani
Helper V
Helper V

I saw in tutorials that they put that output in the "Text" property.

IMG_20220818_192440.jpg

RandyHayes
Super User
Super User

@elaaadani 

Nope, you can't do that.  If you are following a tutorial that tells you to put a flow call in a property...well, I'd stop following that tutorial!!

 

It needs to be in a behavioral property.  That would be on and OnXxxxx action formula for any control that you have that has one and is appropriate.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Ok, but I don't understand. Once I scan the QR code, it triggers a flow in power automate. I just want to display a text that comes from Power Automate. For that in Power Apps I have a text field that has no Onxxx. Do I need another field to display that text ?

RandyHayes
Super User
Super User

@elaaadani 

No, you just need to perform your action when you trigger the flow.  How are you triggering the flow from your app?  

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
elaaadani
Helper V
Helper V

I just put this in my OnScan, but only the first set works

elaaadani_0-1660926227466.png

elaaadani_1-1660926304565.png

 

 

RandyHayes
Super User
Super User

@elaaadani 

Is there any reason for ALL of those variables??  

I would suggest you work with a single variable and a single call to your flow.

Set(varReturn, PruebaPowerapps.Run(BarcodeScanner1.Value))

 

Then, anywhere in your app (like on a Text property of a label), you can reference that variable.

Ex.

  varReturn.rut

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

I have a lot of variables, because they are all different fields from PA and I must show them in the next screen. Or is it not necessary ? Is there another way?

elaaadani_0-1660928721028.png

 

RandyHayes
Super User
Super User

@elaaadani 

No it is not necessary and you should avoid using variables as much as possible in your app.  There are times for them, but excessive variables is frowned upon (even in the Microsoft docs) and it will make your app more difficult to manage, design and troubleshoot.

 

In your case, you will need one variable.  But think record...not just text.

Your flow is returning a record, not a single text.  You are then calling the flow over and over again with the same value to then get each element of your return record.  This is excessive and requiring more flow runs than you need.

 

As mentioned, the only thing you need is the one variable and one call to your flow.

Set(varReturn, PruebaPowerapps.Run(BarcodeScanner1.Value))

 

That variable (varReturn) is going to contain the record returned from your flow.

So, you can reference any column of the record anywhere in your app.

 

varReturn.rut

varReturn.nombre

varReturn.mesa

etc...

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

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