Notifications
Announcements
On the loosing focus from an email field I want to check for an existing contact with the same email. What is the best way to achieve this, using the API ?
Any examples would be great
Gary
Hi @gmanuki
You could use eventually JavaScript when the field last focus and try to call any of the following.
1. You can create a Power Automate flow using the Dataverse environment and use the email field to retrieve the existing email address and call the Power Automate via JavaScript. Below is an example for you
https://www.alphabold.com/how-to-trigger-power-automate-flow-from-power-apps-portals/
2. You can use web API also, and use JavaScript. Have a look at the following answer from @OliverRodrigues
https://powerusers.microsoft.com/t5/Power-Apps-Portals/How-to-retrieve-records-by-Portal-Web-Api/td-p/779069
Especially to retrieve records: https://microsoft-business-applications.hcltech.com/development/creating-a-custom-portal-api-retrieve-data/
3. You can use workflow in the background and retrieve the email field.
Bonus: You can also create plugins if needed.
Hope it helps. ------------
If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.
Just be mindful, that you may open a security hole where someone can farm your users email addresses - so make sure you architect it appropriately (e.g. if you used Web API you need to be aware that that would require Global Read on the Contact record with at least the Email address field exposed, with this setting someone can open the browser debugger/console and write their own query to pull a list of email addresses.)
I will use option 2 since the API now supports GET
There is no need to use the API. I would just flag the table to not allow duplicates or turn the duplicate feature on. This is very common, there are built-in tools. Do this at the DV level of the Portal Env.https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/admin/detect-duplicate-data?view=op-9-1Mark if answered please. Thanks!
@pswider Thanks but I'm validating an email field on loose focus and need to display the error in real time before i commit .
Gotcha. Plug-ins as stated above.
Good luck!
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.
In our never-ending quest to improve we are simplifying the forum hierarchy…
We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Fubar 89 Super User 2025 Season 2
Jerry-IN 75
sannavajjala87 31