Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Answered

Restrict domain for a field

Posted on by 45

I have created one page in that there is one field which email restriction in that field we can restrict some of the domains (eg: @edu.com, @outlook.com) mentioned domains will get restricted.

pastedimage1663673382656v1.png

And in Sales Order whenever select Customer if customer is with one of these email domain then it should give error Email is restricted 

please suggest 

Thank you.

Categories:
  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,023 Moderator on at
    RE: Restrict domain for a field

    Good to know.

  • Pooja Zinjurke Profile Picture
    Pooja Zinjurke 45 on at
    RE: Restrict domain for a field

    Thanks, It has worked

  • PoojaZinjurke Profile Picture
    PoojaZinjurke 15 on at
    RE: Restrict domain for a field

    Thank you, This has worked

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,023 Moderator on at
    RE: Restrict domain for a field

    Hi,

    Adding for info.

    You can use below code to extract the domain values and implement it on OnBeforevalidate Event when you are trying to get Customer info.

    documenttext := 'youremail@domain.com';

    IF STRPOS(documenttext,'@') > 0 THEN

     documenttext := COPYSTR(documenttext,STRPOS(documenttext,'@'),STRLEN(documenttext));

    MESSAGE('%1',documenttext);

    Thanks.

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 69,864 Super User 2024 Season 2 on at
    RE: Restrict domain for a field

    It seems possible.
    I suggest you can create a table with restricted emails. This is easier to handle.
    Then, as Amit mentioned, when the Email field is Onvalidate, verify whether there is a problem.

    The only problem is that you need to extract the part after the @ in the code to judge.

    Hope the following helps.

    https://yzhums.com/6471/

    Thanks.

    ZHU

  • Suggested answer
    Amit Baru Profile Picture
    Amit Baru 3,025 on at
    RE: Restrict domain for a field

    Hi,

    For this when trigger the email, check the domain form the Customer card and matching with that field and shows error.

    Regards

    Amit Sharma

    www.erpconsultors.com

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,552 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,552 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans