cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

OnChange firing on Edit form before form is loaded

I have a edit form which has fields from a SharePoint list.  Two of the fields from the list are People fields, "Assigned To" and "Completed By".  The "Assigned To" allows for multiple values, people only.  The "Completed By" allows for single value, also people only.  Both have a formula that sets respective variables to "YES" for the OnChange event for each datacard.

AssignedTo - Set(ChgdAssgndTo, "YES")

CompletedBy - Set(ChgdCmpltdBy, "YES")

 

Both of these variables are set to "NO" when:

- The App starts

- When changing from the View form to the Edit form.

 

In effect, the user would select a gallery item to View, showing the View form.  From there, they can click a button to edit the item.

 

Problem is that the variable for the "Assigned To" datacard value is set to "YES" when the App is loading, even though both variables are set to "NO" on AppStart.  I have even set both variables to "NO" prior to selecting the item from the gallery to edit.

 

When I changed the SharePoint list so that the "Assigned To" column only allows for single values (instead of multiple values), this false-firing of the OnChange event does not occur.  I have checked the App for all references to variable ChgdAssgnTo and the only place it is being set to "YES" is the OnChange event for field in the data card.

 

Why is this false-firing happening only when multiple values are allowed?

4 REPLIES 4
Resident Rockstar
Resident Rockstar

Hi @BitMaker 

you can set the variable with value no in OnVisible Property for Screen.

VijayTailor_0-1614107725793.png

Thanks,

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."-Vijay

Hi Vijay,

 

These are both global variables and thus I don't see how any variable can have a visible property set to true or false.  Or are you talking about making the datacard value visible or not?  Making the datacard invisible would then prevent a user from selecting a name for either the "Assigned To" or "Completed By" cards.  

Note: These two variables, ChgdAssgndTo and ChgdCmpltdBy are both being passed to a Flow that is connected to the App, amongst other variables.

Helper I
Helper I

hi bitmaker,

i think what vijay is trying to say is you can try updating the variable using the onvisible property of the screen, works in the same way as the onStart, its just when that screen is visible instead of onStart of the app

as for the actual issue of the "false" firing, I'm not really sure the cause, potentially because the field is blank when its created and it might read the code to populate the field and think its a change

can i assume you are using the default property of the datacard? to load in the items?

Thanks for the heads in BlessedCobba.  I did change the OnVisible property of the edit screen to reset these two global variables to "NO".  And yes, I am using the default property on the datacards to load in the items on the Edit screen.  All the values are coming from a SharePoint list and the neither of the two source columns have a default value specified in the List's settings.

 

But my main concern is that when the app is launching, the OnChange property of fields that set these 2 variables to "YES" is firing.  The setting of these variable to "YES" only happens in one place, on the Edit screen for the to datacards.  Both variables are set to "NO" in AppStart.  The basic flow of the 3 screens is:

 

#1- Gallery - to display the list of items.  From here the user selects to view an item or can choose to create a new item.  If they choose to create, these two variables are reset to "NO" before navigating to the Edit screen (#3)

#2- View - Screen used to view the selected item form the Gallery.  From here a user may be able to edit the item (depending on the Status of the item).  Choosing to edit proceeds to the Edit screen, #3.  Before navigating to the edit screen, these two variables are reset to "NO".

#3- Edit - Screen to edit the item and save back to SharePoint (simplified description).  On this screen, in the two respective datacards, the OnChange property is the only place these two variables are set to "YES"

 

Thus, I cannot understand why or how these two variables have a value of "YES" when the app first loads and displays the Gallery.  Why would a tertiary screen have OnChange events fire before that screen is even requested by the app to be loaded/displayed?

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (60,574)