Skip to main content

Fixed: "Behavior Function in a Non-Behavior Property" in Power Apps

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

You type a formula with Set, Navigate or Patch into a property, and Power Apps underlines it in red: Behavior function in a non-behavior property. The formula isn't wrong as such; it's in the wrong place. Functions that do something can only run when something happens, such as a button being selected.

The Error​

The example put a Set into App.Formulas, where named formulas live:

The App.Formulas formula bar with AppTitle = "Career Development Plan"; and LoadCount = Set(gblLoadCount, 1); with Set underlined in red and a tooltip reading Behavior function in a non-behavior property. You can't use this property to change values elsewhere in the app., View Problem and No quick fixes available

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

Studio also reported 1 formula errors exist within the formula. Press F8 to access.

What It Means​

Power Apps has two kinds of properties:

KindExamplesWhat the formula does
Behavior propertiesOnSelect, OnVisible, OnHidden, OnStartRuns actions when something happens
Everything else (data flow)Text, Visible, Fill, Items, App.FormulasCalculates a value, again whenever its inputs change

Microsoft's formula guide explains that functions such as Navigate and Collect can only be used in behavior formulas; in a property that expects a value, such as Text, Visible or Fill, they're flagged as an error. Set, Patch, Notify and the other state-changing functions are in the same group.

The error says it plainly: a value property "can't change values elsewhere in the app".

The Fix​

If you wanted a value: make it a named formula​

LoadCount = Set(gblLoadCount, 1); was really trying to define a value. In App.Formulas, a value is written directly:

App → Formulas
LoadCount = 1;

In the example, the line was simply removed, and the error went with it:

The App.Formulas formula bar with only AppTitle = "Career Development Plan"; and no error

See How to Use Named Formulas in Power Apps.

If you need an action: move it to a behavior property​

When something really should change at a moment in time, put the formula in a behavior property, such as a button's OnSelect. The same Set is accepted there:

Button → OnSelect
Set(gblLoadCount, 1)

The formula bar with the OnSelect property of a button set to Set(gblLoadCount, 1), with no red underline

In the example, Studio reported No formula errors present afterwards. (It was a test; the button's OnSelect was set back to its original value.)

Common Mistakes​

MistakeWhat happensDo this instead
Navigate in a Text or Visible formulaThis errorPut it in OnSelect
Set in App.Formulas to "initialize" a valueThis errorWrite a named formula: Name = value;
Patch to save when a value changes, in TextThis errorSave from a button's OnSelect

Troubleshooting​

SymptomLikely causeFix
The error on App.FormulasA behavior function in a named formulaRewrite as a value, or move it
The error on a control propertyThe property expects a valueUse the control's On... property
Not sure which property you're inThe property list shows itCheck the box to the left of the formula bar

FAQ​

Which properties are behavior properties?​

The ones whose names start with On: OnSelect, OnVisible, OnHidden, OnStart, OnChange and so on.

Can I run an action when a value changes?​

Not from the value's own formula. Use the OnChange of an input control, or an event like OnSelect.

Is this the same as App.OnStart?​

OnStart is a behavior property, so Set is allowed there. Microsoft recommends named formulas instead for values; see What the Enable App.OnStart Property Setting Does in Power Apps.

Conclusion​

Behavior function in a non-behavior property means an action is in a property that calculates a value. Turn it into a value, or move it to an On... property.

Additional Resources​

Stay Updated

Subscribe to our newsletter for the latest tutorials, tech insights, and developer news.

By subscribing, you agree to our privacy policy. Unsubscribe at any time.