Enable email validation for custom forms

Important

This topic is pre-release documentation and is subject to change.

The email validation feature in Dynamics 365 Sales helps validate the primary email address of contact and lead records. By default, this feature is enabled for the main lead and contact forms in the Sales Hub app. However, if you've customized the main lead form, you must manually enable email validation.

Note

These customizations can be applied only to main forms of the Contact and Lead tables.

License and role requirements

Requirement type You must have
License Dynamics 365 Sales Enterprise, Dynamics 365 Sales Premium, or Microsoft Relationship Sales
More information: Dynamics 365 Sales pricing
Security roles System Administrator
More information: Predefined security roles for Sales

Enable email validation

You can add the following customizations for email validation:

Add an event handler to the OnLoad event

Note

This example uses the Contact table. Use the same basic steps to add an event handler to the OnLoad event for the main lead form.

  1. Sign in to the Power Apps portal.

  2. Search for and select your organization's environment.

  3. In the site map, select Tables, and then select the Contact table.

  4. In the Data experiences section, select Forms, and then select your custom contact form of the Main type.

  5. In the Main form pane that opens on the right, select the Events tab.

  6. In the On Load section, select + Event Handler.

  7. In the Configure Event dialog box, select + Add library.

  8. Add the DataHygiene/Data/salesdatahygiene_form_notification_library.js library, and then select it in the list.

  9. In the Function field, enter Mscrm.LeadHygiene.DataHygieneNotificationLibrary.emailAddressValidationFormOnLoad.

  10. Select the Pass execution context as first parameter checkbox.

  11. Select Done.

    Screenshot of the event configuration for the event handler for email validation.

  12. Save and publish the form.

    In the Handlers section, notice that the required event handler has been added to the form. Ensure that the email validation feature is enabled. Learn how to enable email validation.

Add the email control

You must add the email control only to the primary email address field.

Note

This example uses the Contact table. You can use the same steps to add the email control for the main lead form.

  1. Open the contact form as described in the Add an event handler to the OnLoad event section.

  2. In the New Contact form, in the Contact Information section, select Email.

  3. On the Properties tab, in the Components section, select + Component.

  4. In the Add component dialog box, add the ValidatedField_Control component, and then select it.

  5. Select the options for web, mobile, and tablet, and then select Done.

    Note

    Verify that the Show component on options for Email address (default) are removed.

  6. Save and publish the form.

The email control is added to the email address field. Ensure that the email validation feature is enabled. Learn how to enable email validation.

Can't find the options in your app?

There are three possibilities:

  • You don't have the necessary license or role.
  • Your administrator hasn't turned on the feature.
  • Your organization is using a custom app. Check with your administrator for exact steps. The steps described in this article are specific to the out-of-the-box Sales Hub and Sales Professional apps.

See also

Enable email validation
Work with invalid email addresses