Handling variables in SharePoint custom forms built with Power Apps
Image Source: Shutterstock.com
Feb 19, 2023 9:00 PM

Handling variables in SharePoint custom forms built with Power Apps

External Blog Post

It’s possible to create custom forms for SharePoint lists/libraries using Power Apps, directly from the list command bar by using the option Integrate/Power App

It’s possible to create custom forms for SharePoint lists/libraries using Power Apps, directly from the list command bar by using the option Integrate/Power Apps/Customize the form:

This allows you to create a custom form using all features that a Canvas app offers. While you can keep all the out-of-the-box SharePoint list view native features, such as sorting, filtering, grouping & using JSON formatting, you will be able to build an entire new form by using the Canvas apps studio.

https://michelcarlo.com/2023/02/19/handling-variables-in-sharepoint-custom-forms-built-with-power-apps/

Handling variables in SharePoint custom forms

Handling variables in SharePoint custom forms built with Power Apps is the process of storing data temporarily during a form session. Variables can be used to store values, such as user inputs, and objects such as collections or tables. They are also useful for setting up conditions to control navigation within the form.

When working with SharePoint custom forms created with Power Apps, you can use global variables which are visible throughout the app and local variables which have visibility limited only to the screen they were created on. Creating global variables is done by selecting “Variables” from the left-hand menu under “Data” and then clicking on “New variable” from inside that tab. To create a local variable you must select “Screen1” from the left-hand menu under “Screens” and click on “OnVisible property (under Advanced) of Screen1".

Once your variables have been set up, it's important to remember that all updates made will affect both global and local versions of those same values unless specified otherwise when using Set() or UpdateContext(). You should also take into account how changes in one part of your application will impact other parts before making any changes; this could lead to unexpected results if not taken into consideration beforehand.

Dec 15, 2022 — Learn about integration of SharePoint forms with Power Apps, and how to customize those forms.

One small change, I would put the UpdateContext({varFlag:"N"}) in the OnSuccess property of the form. I don't think that you want it to change unless the form ...

Dec 15, 2022 — Reference information about working with state, context variables, and collections in canvas apps.

Sep 28, 2020 — I am having a similar problem. I have tried to set a global variable (Boolean: E.G. varNewForm = true) to capture when the form is new vs. when ...