Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to put code in a component ?



I have created this component with some buttons in it :



I have put this kind of code in the buttons : 

It doesn't seems to work, and the code I put generally in my components never work, this begs the question :
can we insert code in components or are they simply here for decorative purpose ?
Thanks for helping,
Super User III
Super User III


The formulas you use in your component are specific to your component, not to your app.

You cannot reference items within your app in your component.  

This is all because components are designed to be reusable in any app.  So, if you put a screen name in your component formulas to navigate to, that would be specific in your app and thus the component would not be reusable in another app as it would most likely not have that same screen.


In order to do this in an app, you need to set properties on the component with information from your app.

So, for example, if you wanted to have screen names to navigate to, you could supply a table of names to a custom property on your component - like ScreenIndexTable for example.


Set ScreenIndexTable to :  Table({ID:1, screen: screen1}, {ID:2, screen: screen2}) etc.

Then in your component, you can reference that table and navigate from it.

Example, if you had something displaying that related to ID 1, you could set the OnSelect of it 

Navigate(Lookup(myComponent.ScreenIndexTable, ID=1))


This is a VERY crude example which is simply to demonstrate that you need to provide app specific information to your component as your component cannot access anything specific about your app.


I hope this is helpful for you.





Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Super User III
Super User III


I think watching a video would be the most helpful thing here.   This is one by @BrianKnight shows how to add Navigate 'code' to the component.


Link to Youtube:


Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Not applicable

Hi @mdevaney @RandyHayes 


Thanks for answering, I have this problem when I try to create a custom property in my component, nothing shows up in the parameters, and it's the same thing if I want to edit it. I can't remove the custom property I created also.


Here is what it shows when I create a custom property :


@Anonymous're now the second person that I heard of this.  See this post.

Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Helpful resources

PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!


Are Your Ready?

Test your skills now with the Cloud Skill Challenge.


Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (48,482)