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 / 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.
 
 
 
 
Issue.jpg
Categories:
I have the same question (0)
  • Suggested answer
    abc 123 Profile Picture
    789 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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 483

#2
WarrenBelz Profile Picture

WarrenBelz 399 Most Valuable Professional

#3
11manish Profile Picture

11manish 327

Last 30 days Overall leaderboard