I have been having a very weird issue with my PowerApp that the client has reported to me, I am unable to replicate it so troubleshooting has been almost impossible.
Basically, I have an app that will record drivers who are working for a company on each day, the parent company then uses the list of drivers that the app captures for payroll.
The user will see a gallary control that lists each driver's name, they will then click a checkbox next to their name if the driver is working. When the user clicks a checkbox, the driver's name is then added to a collection within the app. The collection captures the data perfectly fine every time, no issues there. The app will then take the drivers from the collection, and log them directly to a Common Data Service entity. I also have a success message that will count the drivers just submitted, it is a CountA function on the CDS entity, so the drivers must be submitted for the CountA function to return anything. Through all of my tests the app has worked perfectly.
Recently I have been getting reports of the app "losing" random drivers. Say Bob logs 10 drivers that are working for Company X today, he hits submit and the app displays a success message: "Success, 10 drivers have been logged for Company X". When bob goes into the functionality on the app that allows him to view previous logs, there are only 6 drivers logged for Company X. THis will be true on the backend inside of the CDS entity, only 6 drivers logged. Somehow the CountA function filtered down the drivers table and found 10 records, but in reality, there was only 6.
I have also had reports of the app displaying the wrong display name, so instead of Company X, the message would show Company Z even though the log was for X. I use context variables to capture the company and make sure to clear them when the user starts the app.
Even weirder is it seems to only happen on rare occassions, once a week tops with about 10 different users logging batches of drivers per day. Since I cannot get these issues to replicate even once on my end, I am at a loss as to what may be causing it, so I decided to try here. The code that is responsible for logging drivers is pasted below, if anyone has any ideas on where to start to solve this bizarre issue it would be greatly appreciated.