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

Prevent patch on data source according to content of second data source

Hi guys,

 

Sorry of the fuzzy subject, I could not figure out a more explicit structure.

 

I first have to provide some context before getting to my issue.

I have two data sources in the form of SharePoint lists.

The first one deals with cases and items are given a specific column corresponding to the status of the case (not submitted, waiting for approval, approved, rejected, archived, etc.).

The second one has items that correspond to reviews of the aforementioned cases. Each review has a lookup column pointing to its related case and its own column status representing the result of a reviewer's examination of the case (unprocessed, approved, rejected).

 

In the app, I use a gallery to display a portion of the entire case list.

However this gallery is linked to a collection that I first populate and regularly refresh from the SharePoint list of the cases.

When a user wants to review a case, they click on one gallery item, which makes them navigate to another screen dedicated to the review. 

And here is my issue: If another user (for instance a case manager who is able to unsubmit a case or change its status in specific conditions) disables the review process of the case just after the first user clicked on, the latter one still will be able to review the case because they will be in the review screen even if they should not have the possibility to do so.

What is the best way to avoid unexpected/aberrant status combinations between both SharePoint lists? I know that concurrent patches on the same list can be handled with the built-in function "errors", but what about concurrent patches on several lists that are linked together via a developper-specified mechanics?

 

Many thanks for your help!

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User III
Super User III

Hi @BenjixLeGauloix ,

This is a case of knowing if a record has been updated by someone else since opening. One way is to test the modified property before saving with something like

If(
   LookUp(
      YourListName,
      ID=ThisItem.ID
   ).Modified <> GalleryName.Selected.Modified,
   Notify("Record has been changed"),
   SubmitForm(FormName)
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

5 REPLIES 5
WarrenBelz
Super User III
Super User III

Hi @BenjixLeGauloix ,

This is a case of knowing if a record has been updated by someone else since opening. One way is to test the modified property before saving with something like

If(
   LookUp(
      YourListName,
      ID=ThisItem.ID
   ).Modified <> GalleryName.Selected.Modified,
   Notify("Record has been changed"),
   SubmitForm(FormName)
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

Hi @WarrenBelz,

 

Many thanks for your answer and sorry for the delay in my reply!

Your suggestion seems to be working for at least 99.9% of cases, however I cannot stop thinking about a situation in which the status of a case is modified just after the LookUp operation and before or at the same time of the Patch. In this context, the condition would let the update to be patched.

 

Is there a way to prevent even this kind of rare configuration? I know that I am pushing a little bit far but I am convinced that if there is a slight chance that this may happen, it will necessarily happen during the whole life of my application.

Thanks in advance!

Hi @BenjixLeGauloix ,

Yes - you are pushing the boundaries and there has to be a point in time you test and be satisfied with the result. The "twilight zone" would be milliseconds. 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

WarrenBelz
Super User III
Super User III

Hi @BenjixLeGauloix ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

BenjixLeGauloix
Frequent Visitor

Hi @WarrenBelz,

I implemented the solution you proposed, which is working fine.

However, I cannot stop thinking about a possible conflict due to simulatenous update (within what you call the twilight zone). I guess that we cannot do much about this currently so the least evil would be to be able to detect irrelevant conflicts in the status of items belonging to my SharePoint lists. I am currently trying to figure out a recurrent Power Automate flow in this purpose (the flow would regularly scan the lists looking for such errors).

I mark you answer as solution.

Thanks again for your help!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (997)