Editing Sharepoint list items by two users at the same time. - InfoPath Dev
in

InfoPath Dev

Editing Sharepoint list items by two users at the same time.

Last post 08-16-2013 07:01 AM by ErnestoM. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 08-15-2013 10:46 AM

    Editing Sharepoint list items by two users at the same time.

    I have a list called "Inventory" with two columns in Sharepoint. A "SKU" and "Quantity" column. I am using an Infopath form with Qrules to edit this list for adding and subtracting Quantity's from the SKU. What happens when two users have the two different forms open and one wants to change the number to "100" and the other users wants to change the number to "200" and they both click Submit at the very same time. I thought about creating an additional field in the list that is a "username locked" text field and every time they click submit, it would do the following. 1) Update the "username locked" field with the current username 2) Query Inventory list 3) If "username locked" field == current user then don't process any rules and prompt user that somebody else is editing inventory 4) If "username locked" field = current user or is BLANK then UpdateListItem 5) Update the "username locked" field to BLANK of Qdabra Success = TRUE 6) Close the Form. I am trying to wrap my head around how well this would work and any issues. Any suggestions? Is there anyway for the Form to notify the user if there is a conflict in updating? Which user would have their items saved it both clicked Submit at the same time? I am assuming the first one. This list could have 1000's of transactions. I though about making each form submit data as a new list item and doing a filtered query to SUM(Quantity) - SUM(Sold) = On Hand Balance. So instead of trying to add and subtract this one list item, I would have all of list items and get summed together. For Example: (Widget A | 100) (Widget A | -10) (Widget A | -40) (Widget B | 1000) (Widget B | -2) (Widget B | -800) etc... SUM Widget A = 60 On Hand SUM Widget B = 198 On Hand Doing it this way might resolve my multiple submit issue. Thanks for the help in advance.
  • 08-15-2013 01:07 PM In reply to

    Re: Editing Sharepoint list items by two users at the same time.

    In the scenario you've described, the last edit "wins".

    I don't believe there's an option to lock list items, but your idea sounds interesting:

    First query to make sure the usernameLocked column is blank. If it's not blank, someone already locked it so show appropriate error.

    You would need to write the list item (using SubmitToSharePointList) to set the usernameLocked column to ernestom, for example.

    When the user is done editing and clicks submit, remember to clear usernameLocked.

    Sounds like a good idea; let us know how it goes!

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 08-15-2013 01:50 PM In reply to

    Re: Editing Sharepoint list items by two users at the same time.

    I will give this a try, thank you. Did you have any thoughts on the best way to calculate inventory? Whether to have one List item in "Inventory List" that Infopath will add and subtract to in the form and update the new value in the list item, or to have each transaction submit to a list as a new item and perform a Sum() on the list query. My concern on the list query is it might have to query and sum thousands of list items to calculate. Are there any Sharepoint or Infopath limitations or performance issues with this? One more question. Say I have the "Inventory List" as described above. I have the SKU Column and the Quantity Column. I have this information being queried into an Infopath Form and populating a repeating table. With 2 different mapping files for the SubmitToSharePointList. One mapping file is set to update the SKU only and the other is set to update the Quantity Only. What would happen if two users submitted at the same time. Say I changed "Widget A" to "Widget Z" for one mapping and the other mapping changed Quantity from "100" to "200". If both ran at the same time, would I expect to see Widget Z at Quantity 200 or would I see the last one that ran which would be either Widget A at 200 or Widget Z at 100? I guess the question is will Sharepoint and SubmitToSharePointList update the same list item at the same time as long as they are editing different column values? Thanks Ernesto!
  • 08-16-2013 07:01 AM In reply to

    Re: Editing Sharepoint list items by two users at the same time.

    tyty4u2:
    I will give this a try, thank you. Did you have any thoughts on the best way to calculate inventory? Whether to have one List item in "Inventory List" that Infopath will add and subtract to in the form and update the new value in the list item, or to have each transaction submit to a list as a new item and perform a Sum() on the list query. My concern on the list query is it might have to query and sum thousands of list items to calculate. Are there any Sharepoint or Infopath limitations or performance issues with this?

    Correct, with a large number of records (thousands) you'll start seeing performance issues. 

    tyty4u2:
    One more question. Say I have the "Inventory List" as described above. I have the SKU Column and the Quantity Column. I have this information being queried into an Infopath Form and populating a repeating table. With 2 different mapping files for the SubmitToSharePointList. One mapping file is set to update the SKU only and the other is set to update the Quantity Only. What would happen if two users submitted at the same time. Say I changed "Widget A" to "Widget Z" for one mapping and the other mapping changed Quantity from "100" to "200". If both ran at the same time, would I expect to see Widget Z at Quantity 200 or would I see the last one that ran which would be either Widget A at 200 or Widget Z at 100? I guess the question is will Sharepoint and SubmitToSharePointList update the same list item at the same time as long as they are editing different column values? Thanks Ernesto!

    You'd see Widget Z at Quantity 200 (as long as each mapping is only updating the one column).

    Good luck! Let us know how it goes.

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.