First time users running into messages saying that they are unable to access records after trying to access records sent via emails. For context, we have a Power Page site that has a form that is linked to a custom Dataverse table called requests. We have successfully configured AAD authentication and contact access table permissions on the requests table.
I'll describe a scenario below:
1. User receives an email with a link to a specific request we would like them to view in our Power Page (e.g. portal.powerappsportals.com/request-form/?id=95eaf62d-cf38-4961-99a1-0e20a1513514
2. User authenticates for the first time, a contact record is created for them.
3. We have a Power Automate flow that triggers whenever a contact record is created. The flow will list all requests that contain the email of the user, and then relate all of those requests to the users contact record that was created in step #2
4. The flow often takes about a minute or so to run depending on how many requests were found in step #3. If the request the user is accessing from step #1 isn't related to the user's contact, they will be shown message saying that they are unauthorized to view the request.
5. Once the flow finishes relating all requests to the user's contact record, the user must refresh the page to see their request.
My question is, how can I ensure that a first time user does not see an unauthorized message upon accessing a request. A rough idea I had was to leverage the WebAPI to relate the users contact to the request upon accessing the page and only render the reqst of this page once the API call succeeds.