Hi,
Note: dates in the following post are in the following format: mm/dd/yyyy.
I have a SharePoint list called Contracts for storing employee contracts. In that list, there are two columns StartDate and EndDate which hold the starting date and ending date of a contract.
I customized the Contracts list form using PowerApps.
Here is my scenario:
- I create a new contract from 12/01/2018 to 12/31/2018 for John Smith
- When I save this contract, in the OnSave event of the form I use a LookUp function to search in the Contracts datasource for a duplicate contract (meaning: another existing contract for John Smith that would overlapp the period from 12/01/218 to 12/31/2018).
- Let's say the contract being created in step 1 is the first one. Since there are no duplicates, the contract is saved.
- So now in my Contracts list I have one item for John Smith from 12/01/2018 to 12/31/2018.
- Let's say that right after creating this contract (I do not refresh the list page) I click the New button again to create another contract for John Smith from 11/01/2018 to 12/15/2018 (which obviously overlapps the previous one)
- When I click on the Save button, no duplicate contract is detected by my LookUp function because the Contracts datasource (probably cached) does not contains the first contract created at step 1 (even though it HAS been created in the list) -> OUCH !
Generally speaking, what I want to point out here is that, as far as you don't refresh a list page, all operations made on the list items are not updated in the datasource "variable" in PowerApps. This can lead to real problems like the one described above.
My question is:
- Should I use the Refresh function on the Contracts datasource to make sure it is up-to-date before checking for any duplicates ? If so, this could lead to performance problem since my customer creates 700 contacts a month; so my list will grow significantly fast and performance will drop as time goes by.
Shouldn't PowerApps itself update the Contracts datasource after submitting it with success ?
Anyone has any idea how I could address this issue ?
Thanks,
Emmanuel