web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Boolean Variable Issue...
Power Apps
Answered

Boolean Variable Issue in Custom SharePoint List Form

(0) ShareShare
ReportReport
Posted on by 244

I have a boolean variable (varUpdated) in a custom SharePoint list form. I set it to false in the OnStart property of App. I then set it to true in the "OnChange" property of editable fields. So when any of these fields change, varUpdated should change to true. 

 

I have a similar set of variables for three other fields to indicate that they have had their values changed (varRequestorComments Changed, varProgrammerCommentsChanged and varAdminComments Changed). All are set to false in OnStart. They are individually set to true in the OnChange property of the appropriate comments field. 

 

I have a corresponding Yes/No field for each of these variables in the SharePoint list. I set the Default and Update properties for each of these Yes/No fields to the corresponding variable. The three comment variables all work exactly as expected. When new comments are added in a comment field, the variable is set to true and updates the Yes/No field properly. The next time the form is edited, the variable is again set to false and this updates the Yes/No field to false if no comments are added to that section. 

 

The purpose behind these variables is to have HTML generated (or not) for an email notification when a record has changes made. The comment fields are working as expected and only display in the email when new comments have been added. 


The varUpdated variable however is ALWAYS true whenever the form is put into edit mode. In view mode, it remains false as expected. I have tried adding Set(varUpdated, false) in the OnView and OnEdit properties of SharePointIntegration both before and after the EditForm and ViewForm functions. No change either way. Once the form is in Edit mode, varUpdated ALWAYS switches to true. It does NOT switch to true in New mode. 

 

The fields that need varUpdated to be true when they are changed are of varying data types. There are date fields, text fields and combo boxes. All I can think of is that one of these field types has its OnChange triggered when the form goes into edit mode. Since the comment fields (MLoT data type) are working correctly, it may be the date or combo boxes that are causing the issue. But the fact that it works properly in New mode confuses me even more.

 

If anyone has experienced this in the past and knows how to resolve it, please let me know!

Categories:
I have the same question (0)
  • CCJones Profile Picture
    244 on at

    UPDATE:

    I removed the Set(varUpdated, true) from all fields and began adding to fields of each data type. Discovered that it is the combo boxes causing the problem. Apparently, something happens to them when the form is set to edit which triggers their OnChange property. No idea why nor how to stop it!

  • Verified answer
    CCJones Profile Picture
    244 on at

    UPDATE:

    Resolved the issue. Since the combobox OnChange is triggering when the form is set to edit mode, added a formula to check whether the value in the control matches the value in the record. If it does not, varUpdated is set to true. Otherwise it remains false. Found the solution here:
    Solved: Onchange event often triggers when screen becomes ... - Power Platform Community (microsoft.com)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 516

#2
WarrenBelz Profile Picture

WarrenBelz 428 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 292

Last 30 days Overall leaderboard