web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Validating entry in mu...
Power Pages
Unanswered

Validating entry in multistep form

(0) ShareShare
ReportReport
Posted on by 323

Hi,

 

We have this step in a multistep form for the user to enter their email address. This is an anonymous access page and form. On clicking next, a record is created in the Contact table and the user is taken to the next step. But, before the user is taken to the next step, we would like to validate if the user already exists in the Contact table (the key being the email address). If the user exists, we would like to display a message in the page asking the user to sign in first and use the authenticated form rather than the current anonymous one. We would also like to prevent the user from then clicking the "Next" button on the step. Please let us know a way forward.

prathyoo_0-1697543892194.png

 

Categories:
I have the same question (0)
  • Lucas001 Profile Picture
    2,429 Super User 2025 Season 2 on at

    Hi @prathyoo,

     

    there are two options I can think - Liquid and CRUD Api Calls.

    But for your option I would suggest CRUD as Liquid will create the problem when somebody will create the account directly after another.

     

    What you will have to do is use the CRUD API(Tutorial)

    Use the eventTrigger onfocusout() or something else matching your case.

    Firing the trigger whould perform a get operation and get all your contacts.

    In case of performance it would be usefull to use the CRUD operation when entering the multistep stage or the multistep page so everything is loaded from the beginning.

     

    After that compare the val() of your input and see if that mail exists inside your JSON-Object from the CRUD call.
    If yes show the message if not show the button.

    In some cases the api could take some seconds depending on the connection - for that displaying a loading icon next to the mail adress input would be great for UX.

    --------------------------------------------------------------------------------------

    Hope that helps.

    If the post solves your problem, please mark it as solution. If it helps, consider a thumbs up.

  • psreek Profile Picture
    323 on at

    From the solution you have provided, this looks like a browser side validation. That means anyone visiting our portal and accessing this anonymous form will get to see all the contact in the dataverse table. That seems to be a serious risk.

  • Lucas001 Profile Picture
    2,429 Super User 2025 Season 2 on at

    Hi @prathyoo,

     

    unfortunately yes, problem is that you want to validate anonymous data with existing data so you will need a way to compare those without sharing to much information. CRUD will be a risk here. But anyway you do it you will at least need the email column to compare which is in most cases a problem with GDPR if you try the way with CRUD.

    Liquid would not work in your case at it needs to validate in realtime which currently is limited by the power pages chache.

     

    The other thing which could work in your case is the new cloud flow integration, but I am not sure how the performance will be when comparing the entire user table. You can find a short introduction here: https://www.youtube.com/watch?v=i-WOCB4Ee1Y


    --------------------------------------------------------------------------------------

    Hope that helps.

    If the post solves your problem, please mark it as solution. If it helps, consider a thumbs up.

     

  • psreek Profile Picture
    323 on at

    Thanks. Wish dataverse could provide a prewrite event that will allow for scripting validations to occur before records are written to the DB and if the validations fail, we should be able to stop the write.

  • Lucas001 Profile Picture
    2,429 Super User 2025 Season 2 on at

    Hi @prathyoo,

     

    unfortunately that is currently not supported. As said you can use the other options.

    Do you have any more questions? Otherwise could you close the thread?

  • psreek Profile Picture
    323 on at

    Just came across this - (3) Use Dataverse low-code plug-ins in Power Pages - YouTube. Will check if this works for us.

  • fm_skeller Profile Picture
    277 Moderator on at

    In this scenario I usually fall back on a bespoke pro-code plugin that triggers on the form session, does the check, and if necessary prevents the form from moving to the next step. By creating a linked record with a message you can surface that message to the user - do not just throw an error in the plugin as this will show the generic 'something went wrong' message to the user.

  • ansrikanth Profile Picture
    329 on at

    As the user is anonymous, I dont suggest to run the code on client side and give access to all contacts to anonymous users. Your best bet if you want to use low code approach is to use the Power Automate. the new connector for Power Pages works very well and is a real time trigger from your on change. In that way the logic is secured and user at max can see that there is a service call happening to a secure API. The power automate then can retrieve your contacts where the email address is matching, if it finds>0 records then validation fails and it ruturns user already existed message to your portal and you need to find a way to display the message and disable the next button. 

     

    The second option (again no code) is, (assuming you will have all the email addresses unique in the contact table), create a unique key on the email address field. When power pages tries to create a contact record with an email address already existed in the system it automatically fails and displays the error message.. the message might look ugly but you should be able to use simple javascript to hide that message and display custom message... 

     

    The third option is to use PreValidate plugin on the contact and throw error message to the user from plugin -> power pages. 

     

    My preference is #1 (the only problem  I see with this is, if you are expecting to have 100s and 100s of calls in an hour you may hit the throttling limit, so you might have to purchase perflow licence in that case).

     

    Thank you

    -Srikanth

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Jerry-IN Profile Picture

Jerry-IN 71

#2
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard