I would like to assign profile to the user based on domain name of the email.If the domain is other and the assigned profile is not matching when creating user. It should throw me error.

For Example:

If(Email Contains "Yahoo.com" && profileName <> "Yahoo Profile) must throw an error.

How to implement this functioanlity on user profile creation as a validation rule?

  • where are you planning to pull the data for domain name and profile name, are they hardcoded?
    – Raul
    Commented Mar 22, 2017 at 14:54
  • Its while insertion of the user record, while am creating so they are hard coded. Can this be done?
    – user43192
    Commented Mar 22, 2017 at 14:57

1 Answer 1


Did you this:

AND(CONTAINS(Email , "Yahoo.com") , 
    Profile.Name <> "Profile Name")

It uses AND and CONTAINS function.

  • without IF condition?
    – user43192
    Commented Mar 22, 2017 at 15:10
  • IF condition returns a boolean value either true as false, AND would return the same.
    – Raul
    Commented Mar 22, 2017 at 15:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .