cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Greg27
Super User
Super User

Behavior function in a non-behavior property. You can't use this property to change values elsewhere in the app.

I have the following statement in the StartScreen of my app:

 

Set(varStudentName, User().FullName)

 

It is giving me the following message:

 

Behavior function in a non-behavior property. You can't use this property to change values elsewhere in the app.

 

Why would I be getting this? I have the same statement in another app and I receive no messages, but where else am I supposed to set a variable name?

1 ACCEPTED SOLUTION

Accepted Solutions
One
Super User
Super User

Hi @Greg27,

 

You will want to move that line of code to the OnStart property to initialize the variable. StartScreen is basically just a simplified way of saying "On Start of the application, navigate to this screen", whereas OnStart is an actual trigger for events like setting variable, creating collections, etc.

 

------------------------------------------------------------------------------------------------------------------------------
Please click "Accept as Solution" if this post answered your question so that it is helpful for people having similar questions. If you found this post helpful smack that Thumbs up button! Thanks!

View solution in original post

7 REPLIES 7
One
Super User
Super User

Hi @Greg27,

 

You will want to move that line of code to the OnStart property to initialize the variable. StartScreen is basically just a simplified way of saying "On Start of the application, navigate to this screen", whereas OnStart is an actual trigger for events like setting variable, creating collections, etc.

 

------------------------------------------------------------------------------------------------------------------------------
Please click "Accept as Solution" if this post answered your question so that it is helpful for people having similar questions. If you found this post helpful smack that Thumbs up button! Thanks!

@One 

Thanks for your help.

seadude
Memorable Member
Memorable Member

@One and @Greg27 , what do you make of this one? 

Scenario:

- Deep-link opens the PowerApp

    - Has a `screen` parameter appended to the URL

    - Example: 

ms-apps:////providers/Microsoft.PowerApps/apps/<my_app_id>?screen=scrWork

- Need the PowerApp to look at the `screen` Param() and Navigate() to correct screen

 

Tried: Placing the following code 3 different places, each with its own ERROR!

 

If(
    !IsBlank(Param("screen")),
        Switch(
            Param("screen"), 
            "work", Navigate(scrWork, Fade)
        ),
    Navigate(scrHome, Fade)
)

- OnStart:

    - ERROR: Navigate is not permitted in OnSTart. Use the StartScreen property instead.

seadude_0-1655321823305.png

- StartScreen:

    - ERROR: Behavior function un an non-behavior property. You can't use the property to change values elsewhere in the app.

seadude_1-1655324776910.png

- OnVisible of the first screen (scrHome):

    - ERROR: Navigate cannot be used here since it would automatically always navigate away from this screen.

        - The error is incorrect by the way! The else statement runs contrary to the statement.

seadude_2-1655324851680.png

 

So... how then, should a deep link be passed to a PowerApp?

@seadude 

I would open that up as a new request. I am really new to Power Apps, but it seems like a really good question. If you do, would you tag me on it as I would love to know the answer.

One
Super User
Super User

@seadude ,

I don't currently have the time to test that out, but theoretically that should work as long as you are setting variables for the screen name you want to use in the onstart property, then pass them to the startscreen property as the screen to be navigated to. you will need to delegate the actions properly by putting behavior functions in the onstart property.

i have this type of issue how can I resolve this issue.

 

Greg27
Super User
Super User

@Shan_kazmi1 As the resolution shows, move the code from the StartScreen property and put it in the OnStart property.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (4,629)