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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to read once more ...
Power Apps
Unanswered

How to read once more current sharepoint list item before update ?

(0) ShareShare
ReportReport
Posted on by 19

Is it possible to read once more the current SharePoint list item before updating it? The need is to verify if the item has been updated in the meantime and thus eventually take another action such as notify the user.

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,989 Moderator on at

    @NewDev 
    The better method is to create a new column called "Locked" in your SharePoint list and check it prior to editing the record.  

     

    When the user accesses the record check to see if its locked.  I assume you are navigating from a gallery to a screen with an edit form.

     

    Set(currentRecord, LookUp(your_datasource_name, ID=Gallery1.Selected.ID));
    If(currentRecord.Locked
     Notify("This record is currently locked for editing ,Notification.Error),
     Patch(your_datasource_name, currentRecord, {Locked: true});
    )
    Navigate(your_next_screen);

     

    On the Edit screen put this code in the DisplayMode property of the submit button to disable it when the record is locked

     

    If(currentRecord.Locked, DisplayMode.Disabled, DisplayMode.Edit)

     

    Then you'd have a submit button with this code in OnSelect

     

    SubmitForm(your_form_name)

     

    Finally, use this code in the OnSuccess property of your Edit Form

     

    Patch(your_datasource_name, currentRecord, {Locked: false});

     

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

     

  • NewDev Profile Picture
    19 on at

    Your assumptions are perfectly correct. Wouldn't a timestamp be better? I could check if the item I'd like to edit/update is still the same or has changed in the meantime. Otherwise when would the locked column be set and unset?

  • mdevaney Profile Picture
    29,989 Moderator on at

    @NewDev 
    Yes, I think you are right...

    Maybe you could put this code in the OnSelect property of the gallery where you choose the record to edit.

    Set(currentTime, Now());
    Set(currentRecord, LookUp(your_datasource_name, ID=Gallery1.Selected.ID));
    

     

    Then put this code in the OnSelect property of the Submit button.

    If(
     LookUp(your_datasource_name, currentRecord, Modified) < currentTime,
     SubmitForm(Form1),
     Notify("Record was already modified by another user")
    );

     

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

  • mdevaney Profile Picture
    29,989 Moderator on at

    @NewDev 

    Did I answer your question here?  Please let me know.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard