Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building 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!

  • Verified answer
    CCJones Profile Picture
    244 on at
    Re: Boolean Variable Issue in Custom SharePoint List Form

    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)

  • CCJones Profile Picture
    244 on at
    Re: Boolean Variable Issue in Custom SharePoint List Form

    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!

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,668 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard