Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - General Discussions
Unanswered

First time users are unauthorized to access records sent to them via email

(0) ShareShare
ReportReport
Posted on by 49

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.

Categories:
  • Hapa1 Profile Picture
    49 on at
    Re: First time users are unauthorized to access records sent to them via email

    Thanks again @EmadBeshai 

    Thought I'd share that the issue I was running into was because of caching rather than the form rendering before the API call finishing. The scenario is as follows:

    1. New user accesses the form directly and a contact is created for them.

    2. I am able to see in the dev console that API call to relate the contact created in step #1 to the request finishes successfully and is reflected in Dataverse.

    3. However the Power Page form still shows that the user is unauthorized to access the form

    4. I clear the cache via the admin portal. The user is now able to access the form.

     

    Because I am not able to clear cache programmatically, I had to implement something like Using the Power Apps portals WebAPI to Clear the Portal Cache – ReadyXRM where upon landing on the form, I redirect the user to another page and make the API call there. Once the API call finishes I redirect the user back to the form where I am now able to see my data.

    Have you run into any similar issues with caching or do you have any thoughts on this approach? I'm not really a big fan of a workaround like the one I just implemented.

  • EmadBeshai Profile Picture
    806 Super User 2025 Season 1 on at
    Re: First time users are unauthorized to access records sent to them via email

    Hi @Hapa1

     

    You can't stop the form loading till getting your API response, but you can show loader on a top of your form then closing this loader once you get the response.

    If you need more clarification please let me know.

     

    If this post helps you with your problem, please mark this answer as Accepted Solution.

    If you like my response, please give it a Thumbs Up. 

  • Hapa1 Profile Picture
    49 on at
    Re: First time users are unauthorized to access records sent to them via email

    Thanks @EmadBeshai, I got the API working but now I'm wondering how can I ensure that the form rendering waits for the API to finish?

  • EmadBeshai Profile Picture
    806 Super User 2025 Season 1 on at
    Re: First time users are unauthorized to access records sent to them via email

    Hi @Hapa1 ,

     

    The idea you have suggested would work, also you can trigger a real-time action like Plugin or register Power Automate as a webhook (sync) on the creation of the contact to fetch all related requests and link them to that contact.

     

    If this post helps you with your problem, please mark this answer as Accepted Solution.
    If you like my response, please give it a Thumbs Up. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >