cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ericonline
Community Champion
Community Champion

Determine Changes EditForm

Hello,

I'm curious what ya'll are doing to detect changes between a submitted record and an EditForm

Example:

  • DataSource: Sharepoint List
  • User Experience:
    • User submits a new record using a Form control
    • User visits a "View/Update" screen which displays records of a certain status (say "Open")
    • User selects a record to View/Update
    • Form is displayed in ViewMode
    • User clicks "Edit" icon
    • Form is displayed in EditMode
  • Goal:
    • I want to control the DisplayMode of the Submit button to ONLY be editable IF something changes between the record stored in Sharepoint and the values in the form. 
    • If user changes a value, then changes it back to the original value, I want the Submit button to go back to Disabled.

Anyone have insights into this pattern? I can think of a few ways to do with a Collection, a timestamp and UpdateIf, but when using a Form control, I don't want to write a formula against each control in this Form.

I thought I could set a variable (varEditForm) to form.Updates when the "Edit" button is clicked, then IF varEditForm = form.Updates, DisplayMode.Disabled... but... I get an "Invalid Argument" error when trying to compare the two.

image.png

They are both records, why not comparable?

image.png          image.png

1 ACCEPTED SOLUTION

Accepted Solutions
ericonline
Community Champion
Community Champion

Figured out a decent way to do this...

  1. OnSelect of the "Edit" icon/button, Set(varEditForm, frmName.Updates)
    1. This sets a baseline to the forms current status
  2. Set the "Submit" button's DisplayMode to the below code
    1. This could get unwieldy if you have many columns in your DataSource, but works for my use case
If(
    And(
        frmName.Mode = FormMode.Edit,
        frmName.Updates.column1= varEditForm.column1,
        frmName.Updates.column2= varEditForm.column2,
        frmName.Updates.column3= varEditForm.column3,
        frmName.Updates.column4= varEditForm.column4
    ),
  
    DisplayMode.Disabled,
    DisplayMode.Edit
)

 

View solution in original post

1 REPLY 1
ericonline
Community Champion
Community Champion

Figured out a decent way to do this...

  1. OnSelect of the "Edit" icon/button, Set(varEditForm, frmName.Updates)
    1. This sets a baseline to the forms current status
  2. Set the "Submit" button's DisplayMode to the below code
    1. This could get unwieldy if you have many columns in your DataSource, but works for my use case
If(
    And(
        frmName.Mode = FormMode.Edit,
        frmName.Updates.column1= varEditForm.column1,
        frmName.Updates.column2= varEditForm.column2,
        frmName.Updates.column3= varEditForm.column3,
        frmName.Updates.column4= varEditForm.column4
    ),
  
    DisplayMode.Disabled,
    DisplayMode.Edit
)

 

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (17,724)