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

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to use Launch func...
Power Apps
Unanswered

How to use Launch function in an If

(0) ShareShare
ReportReport
Posted on by 6
I am generating a pdf with a flow in power automate this returns me a link to download the pdf but I can not get the Launch function to run inside the if, it only works on a button?
 
If(
    !IsBlank(pdfLink);
    Notify("El PDF ha sido generado ya puedes descargarlo!"; NotificationType.Success);
    Launch("https://cepucmmedu.sharepoint.com/teams/PasantasEICT609" & pdfLink)
);;
Categories:
I have the same question (0)
  • Suggested answer
    SpongYe Profile Picture
    5,603 Super User 2025 Season 2 on at
    How to use Launch function in an If
    Hello, 
     
    Launch can only be used in behavior formulas. Launch and Param functions
    By selecting a Button control, the user initiates a sequence of actions, or behaviors, that will change the state of the app.
    Because these functions change the state of the app, they can't be automatically recalculated. You can use them in the formulas for the OnSelect, OnVisible, OnHidden, and other On... properties, which are called behavior formulas.
     
    Hope this helps.
  • Mark Nanneman Profile Picture
    991 Super User 2025 Season 2 on at
    How to use Launch function in an If
    The formula appears to have a syntax issue, unless things are different in your language/region.  

    For me to get this function to work, I'd have to write it like the following (with a comma after the first If() condition.
    Also, I had to add commas for the Notify() function, to set the type and timeout.


    And I did test it and it did work--however if you don't set a long enough duration on the notification, you will never see it.  It immediately pops you over to the new tab w/ the link.

    If you want to force the user to see the notification message, put it in a popup container that is normally hidden, and use your formula to toggle the visibility of the popup component, and have a button there that Launches the link.
    ​​​​​​​
    If this helped you, please click "Does this answer your question" and give it a like to help others in the community (+ close the ticket)!

    Power Platform Developer | LinkedIn: Mark Nanneman | Blog: Power Stuff  | YouTube: Mark's Power Stuff  |
  • AG-15111838-0 Profile Picture
    6 on at
    How to use Launch function in an If
    You are right Mark Nanneman, it is because of my language that the syntax is a little different, when you use a , I must use ; and when you use ; I use ;;

    The if works for me, what I can't achieve is to open immediately the new tab with the link as you say. Surely it is because of what @SpongeYe says, it is not possible and what I am looking for is not to have 2 buttons in the gallery, one to trigger the flow that generates the pdf and another to launch the link and download it.
     
  • Suggested answer
    SaiRT14 Profile Picture
    1,990 Super User 2025 Season 2 on at
    How to use Launch function in an If
    Instead of directly using Launch inside the If, you can manage it with a variable and a separate button or function call.
    If(
        !IsBlank(pdfLink),
        Notify("El PDF ha sido generado, ya puedes descargarlo!", NotificationType.Success);
        Set(varPdfLink, "https://cepucmmedu.sharepoint.com/teams/PasantasEICT609" & pdfLink)
    )
     
    OnSelect property:
    If(!IsBlank(varPdfLink), Launch(varPdfLink))
     
    you can call the Launch function conditionally using a timer component:
    Start = !IsBlank(varPdfLink)
     
    Use the OnTimerEnd property to trigger the Launch
    If(!IsBlank(varPdfLink), Launch(varPdfLink))
     
  • Mark Nanneman Profile Picture
    991 Super User 2025 Season 2 on at
    How to use Launch function in an If
    Strange...  It is possible for me to use the Launch within an If() function.  I was able to basically put your formula verbatim into my power app, just changing the syntax for English and it worked.

    If you remove the "Notify" action does it work?

    I'm glad you found a work around though!
     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 757 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard