Forum Stats

  • 3,826,752 Users
  • 2,260,703 Discussions
  • 7,897,071 Comments

Discussions

Email Address Validation is not validating (DOR, Groovy Validation)

Muneeb Ahmed
Muneeb Ahmed Member Posts: 4 Green Ribbon
edited May 11, 2022 6:22AM in HCM Cloud Service

Asalam Alaikum (Greetings to reader)!

I am having issue while trying Groovy Validation in DOR for validate Email Address. I also done some R&D, and found multiple threads regarding this are:

1) https://docs.oracle.com/en/cloud/saas/sales/22a/oasal/groovy-support-for-email-address-format-validation.html#s20073309

2) https://docs.oracle.com/en/cloud/saas/applications-common/21d/oacex/groovy-scripts.html (Section: Adding Validations to Fields)

3) https://blogs.oracle.com/fadevrel/post/common-regular-expression-patterns

But its still providing error when it comes to save DOR. Also tried multiple REGEX validation, which works on groovy console, but not in DOR.

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

^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$

([a-z]+(\.)?[a-z0-9]+)@([a-z]+)\.{1}([a-z]{2,8})

/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2}))$/ 

/^[a-zA-Z0-9._%+-][email protected][a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$/

------

def emailStr = "[email protected]"

def regexStr = /^[a-zA-Z0-9._%+-][email protected][a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$/

if (emailStr.matches(regexStr)){

 // If we arrive here then the emailStr is a correctly formatted email string

} else {

 // If we arrive here then the email address is not correctly formatted and needs to be handled somehow.

------

([a-zA-Z]+)(\.)?(_)?([a-zA-Z0-9]+)\@{1}([a-zA-Z]+)\.([a-zA-Z0-9]){2,8}

[a-zA-Z0-9]+\@[a-zA-Z0-9]+\.[a-zA-Z0-9]{2,4}

/[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})/

------

def emailStr = "[email protected]"

def regexStr = /^[a-zA-Z0-9._%+-][email protected][a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$/

if (emailStr.matches(regexStr)){

return true

}

------

/^[a-zA-Z0-9._%+-][email protected][a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$/

FlexSeg?.companyEmailAdd.toString() == null || FlexSeg?.companyEmailAdd.toString() ==~ /^[a-zA-Z0-9._%+-][email protected][a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$/

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

These regex are validating on groovy console, but not with application. Can any one suggest anything I can do to resolve this issue.

Thank you,

Regards,

Tagged:

Best Answer

  • Muneeb Ahmed
    Muneeb Ahmed Member Posts: 4 Green Ribbon
    Answer ✓

    Thank you to read my question. The validation working is below:


    if(FlexSeg?.companyEmailAdd ==~ /[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})/)

    return true


    The issue was with the users, when I tried new user, this validation was working fine.

Answers

  • Muneeb Ahmed
    Muneeb Ahmed Member Posts: 4 Green Ribbon
    Answer ✓

    Thank you to read my question. The validation working is below:


    if(FlexSeg?.companyEmailAdd ==~ /[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})/)

    return true


    The issue was with the users, when I tried new user, this validation was working fine.