Hi All This is Sunitha. How to validate email attribute in person entity .

email should end with @gmail.com.  while person will enter the email system should give the direction as (XXXXX@gmail.com).how to get this feature by using validation or some other rule.
2 answers

Hi Sunitha, you can use regex to validate the email address using decision activity

For e.g:

if you just want to accept gmail address you can use:

isMatch($Person/EmailAddress ,'^[a-zA-Z0-9._%+-]+@gmail\.com')


And if you want to validate generic email address, you can use below regex:

isMatch($Person/EmailAddress ,'^[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$')


Hello Sunitha,

I agree with Umesh. Alternatively, you can add validation in Mendix itself using ‘endswith’ function.

Means, create a boolean variable with value as true. Then add a decision. In that you can add the following:

endswith($entityname/attribute, ‘@gmail.com’). The output of the expression leads to boolean. If true, proceed with the next validation, if false, show validation message which says that email is not correct, change the boolean value to false and end the microflow.

I have added a microflow images.

Hope this helped you!