function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mbruso3mbruso3 

Validation Rule - Profile Merge Fields Not Working

None of the below Validation Rules return an error when the user forgets to enter a Phone Number.
Option 1
AND(
$Profile.Name = "System Administrator",
Phone=""
)
Option 2
AND(
    $Profile.ID  = "00e20000000hGsFAAU",
  Phone=""
)
Option 3
AND(
    $User.ProfileID  = "00e20000000hGsFAAU",
  Phone=""
)
rprrpr

I recently ran into a situation in a validation rule where I was checking for nulls, and learned that text fields are never null, even when they are blank.  There is information about this in online help, and the recommendation solution is to use the LEN function:  https://na4.salesforce.com/help/doc/user_ed.jsp?section=help&target=fields_validation_considerations.htm&loc=help&hash=topic-title

I don't know if the phone field is considered a text field or not, but it may be worth giving the LEN function a try.

EricBEricB
There are a couple of obscure issues here which I will make sure are better covered in the online help in the future.

1) The standard profiles have special names that are different than the labels.  For example, the "System Administrator" profile's actual name for formula purposes is "PT1".

2) When using IDs in formulas, you should use the 15 character ID rather than the 18 character ID.

Thus, the following should work for your case:

Code:
AND(
$Profile.Name = "PT1",
Phone=""
)

You can also try your other options and substitute the 15 char IDs.

Regards,
Eric


Eric Bezar
Platform Product Management

Message Edited by EricB on 05-14-2007 10:43 PM

EricBEricB
Good point about text fields never being null.  However, an expression that equates a text field with an empty string ("") should work.

MyTextField__c = ""

But you should avoid using ISNULL() and NULLVALUE() functions with text fields.