I have an application that is running fine whilst online, without any issues. I have put in a set of commands which check to see if I am connected, if I am, I just Patch straight back to CDS (works great), otherwise I store the record in a collection to be saved once connection is restored. One of the columns in the collection is a lookup field, and I save that as a record in the collection. I then have a timer, every 10 seconds checks to see if we have connection established, if the connection is established, I then Patch it back into CDS. As that column is a reference to record, that should save ok, but I get an error "Value must be a data entity record", which it is. So I tried doing a First(Filter(Bookings, booking=bookingId.Booking)), and this saves correctly, but when I look at the data in CDS, that reference is pointing to the wrong booking. Below are the commands: BookingId is set in a Global Variable, and I know it is picking the correct Booking, as I have created a Dubug screen where I can check the contents of an collections or variables.
Digging a little deeper, when online it works as it is using the connection to CDS, so the reason why it fails when offline is beacuse it is using the collections (local store) to access the booking and instructor, so my question narrows down to - how should I be finding the booking and instructor records from a collection?
I have left this for the moment as I have many other apps to get on with. It is definitely something to do with how I am retrieving the lookup values from the collection. I have created a debug page where I can view the content of the collections and all the items I expect to have are there. It is very frustrating, but must be something very simple.
I would be interested in a solution to this. I am having a similar issue where I am trying to Patch a new record and link it with a related entity. The relationships are already set but PowerApps is displaying some horrendous behaviours where it's been working fine before.