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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Best practice navigati...
Power Apps
Suggested Answer

Best practice navigating to external site from menu

(0) ShareShare
ReportReport
Posted on by 100
Hello,
 
I am using a component as my menu and I have the menu items set to load the CustomNavigation.
I've build my menu in my App's Formula's so I can easily load the same menu on all my different pages.
 
My App Formula's looks like this:
CustomNavigation = Table (
   {
        MenuName: "Item 1",
        MenuID: 7,
        PageNavigation: Screen1
    },
    {
        MenuName: "Item 2",
        MenuID: 8,
        PageNavigation: Screen2
    }
)
 
 
 
For the first menu item "Item 1" it navigates to Screen1, but for Item 2 I want it to navigate to an external website.
Usually you can do this using the Launch() function, but that doesn't seem to work in my case.
 
As a workaround I've made it so that it goes to Screen2. Then on Screen2 I run a timer set to 1 sec to launch to the external site and navigate back to my home screen.
This works, but I'm looking for a better solution since I don't like it.
 
What I want, is to update the App's Formula to something like this:
CustomNavigation = Table (
    {
        MenuName: "Item 2",
        MenuID: 8,
        PageNavigation: Launch("https://www.example.com")
    }
)
 
This doesn't work. I get an error (screenshot attached) saying: "Behavior function in a non-behavior property. You can't use this property to change values elsewhere in the app"
 
How can I easily make this work? All I want is to update my PageNavigation to launch the external website directly from the menu. I don't link to my current workaround to navigate to another screen with a timer to redirect back to my home screen and to launch the external site on timerend.
 
 
 
 
Categories:
I have the same question (0)
  • Suggested answer
    abc 123 Profile Picture
    784 Moderator on at
    Just did this last week. First, update the table to contain another parameter:
     
    Set(gtblMenuVert_MenuItems,
        Table(
            If(gcfAdminSI,
                {
                Image: pngHome,
                MenuID: 1,        
                MenuLabel: "Admin",
                MenuURLNavigate: gstrURL_SIAdmin,
                SubMenu: Table({
                        MenuLabel: "Reference Data",
                        Image: pngEnergy,
                        MenuScreenNavigate: Blank(),
                        MenuURLNavigate: gstrURL_SIAdmin,
                        MenuID: 1.1
                    })
     
    Next, modify the component menu item to handle the different actions:
    If(ThisItem.MenuScreenNavigate.Name <> Blank(),
        Navigate(ThisItem.MenuScreenNavigate);
    );
    If(ThisItem.MenuURLNavigate <> Blank(),
        Launch(ThisItem.MenuURLNavigate, Blank(), "New")
    );
     
     
  • WesleyE Profile Picture
    100 on at
    Thanks for your reply! I haven't had a chance yet to test your solution, but hopefully I will somewhere next week.
     
    By looking at your code I do have some questions though.
     
    As "MenuURLNavigate" you have it configured as "gstrURL_SIAdmin" what is this?
    Would I be able to replace that with the Launch code? like Launch("https://www.example.com")?
     
     
    I assume this is the "button" code in your menu component? right?
    If(ThisItem.MenuScreenNavigate.Name <> Blank(),
        Navigate(ThisItem.MenuScreenNavigate);
    );
    If(ThisItem.MenuURLNavigate <> Blank(),
        Launch(ThisItem.MenuURLNavigate, Blank(), "New")
    );
     
     
    I guess it'll make more sense when I am able to test the code myself :)
  • WesleyE Profile Picture
    100 on at
    I was able to test the code and I've got everything working, thanks so much! A much better fix!
     
    I do have some error though on my menu items, it's telling me "expected a different collection record structure.", but everything works as expected. It's not a red error, it's the yellow one, like a delegation error. 
     
    Do you have that as well? Maybe something is wrong in my table still, I'll take a look later.

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard