web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Respond to PowerApps F...
Power Apps
Answered

Respond to PowerApps Flow Variable

(1) ShareShare
ReportReport
Posted on by 198

Hello,

@iAm_ManCat 

You responded to a user on this topic: https://powerusers.microsoft.com/t5/Building-Power-Apps/Respond-to-a-power-app-or-flow-Variable-help.... I was wondering, if I have a global variable varReturnResponse and I have two variables I can call(successmsg and errormsg), How would I go about using the notification function to display the correct message? 

Micaiah_0-1708624047471.png

 

This is the gist of what I have so far. Any help would be greatly appreciated.

Categories:
I have the same question (0)
  • Verified answer
    iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Sure,

     

    So it looks like you are already setting this as a variable, varReturnResponse, so you should set the flow run as varReturnResponse then use an if condition separately afterwards

    Something like this (replaced your control names with generics, please change all of those to your control names):

     

    Set(varReturnResponse,
     FlowName.Run(
     abc.Value,
     def.Selected.Value,
     ghi.Selected.Displayname,
     jkl.Value,
     If(IsBlank(mno.Value), "", mno.Value),
     If(IsBlank(pqr.Value), "", pqr.Value),
     If(IsBlank(stu.Selected.Value), "", stu.Selected.Value),
     If(IsBlank(vwx.Selected.Value), "", vwx.Selected.Value),
     User().FullName,
     User().Email
     )
    );
    If(Len(varReturnResponse.successmsg)>0,
     Notify("" & varReturnResponse.successmsg, NotificationType.Success, 10000),
     Notify("" & varReturnResponse.errormsg, NotificationType.Error, 10000)
    )

     

     

    Cheers,

    Sancho

  • Micaiah Profile Picture
    198 on at

    Now I'm getting errors like this:

    Micaiah_0-1708626257353.pngMicaiah_1-1708626291140.pngMicaiah_2-1708626324809.png

     

  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Did you replace the flowname in Flowname.Run( ?

  • Micaiah Profile Picture
    198 on at

    Silly me, that was the issue. Now the messages are displaying correctly. Thank you so much!

    However, now I'm noticing the form still submits even though a required field was left blank and the correct error message shows up. Is this something I need to fix on the power automate flow side?

    This is the required fields piece I have in flow.

    Micaiah_0-1708628434736.png

     

  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    I would say, that you should use some login in the DisplayMode of the button that is running the above code to only be enabled when all required fields are filled - that way you can't press the button or run the flow until all required fields are completed

  • Micaiah Profile Picture
    198 on at

    Thank you! That works. For anyone interested in the code: 

    If(FormName.Valid,DisplayMode.Edit,DisplayMode.Disabled). 
     
    Lastly, for curiosity's sake, I would no longer need a variable for the error message since I went with the "disable submit button" route correct? Would I even need the required fields piece in my flow?
  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    If that's the only possible error then yes - in my experience there are many other ways a flow can error and I would always catch that at the end of the flow and pass it back to the app so that at least the user is aware of what went wrong.

  • Micaiah Profile Picture
    198 on at

    You've been very helpful, thanks so much! I'll take a look at the try, catch method and see how that works.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 392 Most Valuable Professional

#2
11manish Profile Picture

11manish 181 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 112 Super User 2026 Season 2

Last 30 days Overall leaderboard