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
nickfs92840nickfs92840 

Validation Rule to exempt user profile from a current validation rule

Here is the scenario, have a percentage field (percent__c), that currently has a validation rule setup to when it is left blank, the user must fill it in before saving or it will error out. What I need is for a particular user profile to be exempt from the validation rule I have setup and save the record wether the field is blank or not. 

 

Here is my attempt to in my validation rule but does not work at all, help! :)

 

ISBLANK(TEXT(percent__c),
NOT($Profile.Name = "System Administrator"
)
Best Answer chosen by Admin (Salesforce Developers) 
phiberoptikphiberoptik
AND(
    ISPICKVAL(xxx_Category__c, "Rate Deterioration"), 
    OR(ISBLANK(percent__c), percent__c < 0.01),
    $Profile.Name <> "System Administrator"
)

 

There is no reason this shouldnt work then.

All Answers

Steve :-/Steve :-/

Try

 

AND(
ISBLANK(TEXT(percent__c),
$Profile.Name <> "System Administrator")

 

phiberoptikphiberoptik

You are so close...

 

AND(
ISBLANK(TEXT(percent__c)),
NOT($Profile.Name = "System Administrator")
)

or a shorter version: 

AND(
ISBLANK(percent__c),
$Profile.Name <> "System Administrator"
)

 

 

phiberoptikphiberoptik

Cmon SteveMo... youre SLIPPIN! It must be that your chain ain't white gold!

 

You forgot the end parenthesis for the ISBLANK() function...

Steve :-/Steve :-/

**bleep** it!  that's what I get for doing it on the fly

nickfs92840nickfs92840

ha you guys are funny, however, it didn't work. 

 

Here is the current VR that triggers a user to enter data into the percent field: 

 

AND( ISPICKVAL(xxx_Category__c, "Rate Deterioration"), 
OR(ISBLANK(percent__c),percent__c < 0.01))

 

In the VR you provided, I still get an error when I leave the percent field blank. 

 

Does the current VR (shown above), need to be included in the VR you provided? 

 

Thanks!

phiberoptikphiberoptik

Are you sure your Profile is System Administrator? There is no reason one of the rules I provided should not work.

Steve :-/Steve :-/

How is your VR set to treat blank fields?

nickfs92840nickfs92840

Yes, I'm the SA

 

The VR is set when a particular picklist item is chosen and the percent__c field is left blank, when the user tries to save, it will error out and prompt the user to enter the %

phiberoptikphiberoptik

Yes, +1@ SteveMo... is the VR treating blanks as blanks or zeros? It has to be treating them as blanks.

nickfs92840nickfs92840

Blanks...

phiberoptikphiberoptik
AND(
    ISPICKVAL(xxx_Category__c, "Rate Deterioration"), 
    OR(ISBLANK(percent__c), percent__c < 0.01),
    $Profile.Name <> "System Administrator"
)

 

There is no reason this shouldnt work then.

This was selected as the best answer
nickfs92840nickfs92840

It worked! Thanks so much!

 

I have one more and needs the same function to ignore the user profile and here is my current rule:

 

 

IF( AND(len( text(Prior_MPI_Rates_IP_OP__c))>0,len(text(MPI_Points_Change__c))=0), true,false)

 Please let me know if it can be modified to ignore the System Administrator profile. Thanks!!!

phiberoptikphiberoptik
AND(
    IF( 
       AND(len(text(Prior_MPI_Rates_IP_OP__c))>0,
       len(text(MPI_Points_Change__c))=0), true,false
       )
    $Profile.Name <> "System Administrator"
   )

 

nickfs92840nickfs92840

Thanks for the quick response!

 

When I check it, i get this error: Error: Syntax error. Missing ')'

nickfs92840nickfs92840

Nevermind, got it:

 

AND( IF( AND(len(text(Prior_MPI_Rates_IP_OP__c))>0, len(text(MPI_Points_Change__c))=0), true,false ), ($Profile.Name <> "NS Sys Admin" ))

 Thanks again!!!!!!

phiberoptikphiberoptik

Glad it worked out.