Ask Search:
James RogersJames Rogers 

a validation rule, so that, only a specific profile can change a pick list value to "approved" on a custom object

Hi 

I have been trying to make a VR work, so only a specific profile can change values in a  picklist field to "approved"

open to ideas, i have tried that many now i'm starting to confuse myself, my last attempt is below, any help greatly appreciated :)

AND 



ISCHANGED(Finance_Approval_Status__c), 

NOT(ISPICKVAL( Finance_Approval_Status__c , "Approved")), 

NOT(ISPICKVAL( Guarantee_Approval_Status__c , "Approved") ), 

$Profile.Name = "HOT" 

)

 
Best Answer chosen by James Rogers
Steve MolisSteve Molis
Try this
 
AND( 
$Profile.Name <> "HOT",
OR(
AND(
ISCHANGED(Finance_Approval_Status__c), 
TEXT(Finance_Approval_Status__c) = "Approved"
), 
AND(
ISCHANGED( Guarantee_Approval_Status__c ),
TEXT( Guarantee_Approval_Status__c) = "Approved"
) 
)
)

PS.  Personally I would break this into 2 separate validation rules 
1
AND( 
$Profile.Name <> "HOT",
ISCHANGED(Finance_Approval_Status__c), 
TEXT(Finance_Approval_Status__c) = "Approved"
)

AND( 
$Profile.Name <> "HOT",
ISCHANGED( Guarantee_Approval_Status__c ),
TEXT( Guarantee_Approval_Status__c) = "Approved"
)

 

All Answers

Dnyaneshwar AghawDnyaneshwar Aghaw
Hi James,

Try below Validation Formula ; 
AND(
 OR (
 TEXT(Finance_Approval_Status__c) = 'Approved' , 
 TEXT(Guarantee_Approval_Status__c) = 'Approved' , 
    ) , 
 $Profile.Name <> 'HOT'

)

 
James RogersJames Rogers
Hi Dnyaneshwar

Thank you for the fast reply, how would the rule look if i was to split it out, to be 2 individual rules, so i can get the validation rule against each specific field :)

Thanks a lot 

JR
Naveen DhanarajNaveen Dhanaraj
why do you want to split in to Two Validation Rule ?

Try Like this,
AND(
    TEXT(Finance_Approval_Status__c) = 'Approved',
    $Profile.Name <> 'HOT'
)
AND(
    TEXT(Guarantee_Approval_Status__c) = 'Approved' , 
    $Profile.Name <> 'HOT'
)
Even you can add Muliple profile IN single Validation Rule,
AND(
    OR (
        TEXT(Finance_Approval_Status__c) = 'Approved' , 
        TEXT(Guarantee_Approval_Status__c) = 'Approved' , 
    ) , 
    $Profile.Name <> 'HOT',
    $Profile.Name <> 'COLD'

)



 
Steve MolisSteve Molis
Try this
 
AND( 
$Profile.Name <> "HOT",
OR(
AND(
ISCHANGED(Finance_Approval_Status__c), 
TEXT(Finance_Approval_Status__c) = "Approved"
), 
AND(
ISCHANGED( Guarantee_Approval_Status__c ),
TEXT( Guarantee_Approval_Status__c) = "Approved"
) 
)
)

PS.  Personally I would break this into 2 separate validation rules 
1
AND( 
$Profile.Name <> "HOT",
ISCHANGED(Finance_Approval_Status__c), 
TEXT(Finance_Approval_Status__c) = "Approved"
)

AND( 
$Profile.Name <> "HOT",
ISCHANGED( Guarantee_Approval_Status__c ),
TEXT( Guarantee_Approval_Status__c) = "Approved"
)

 
This was selected as the best answer
James RogersJames Rogers
Thank you Steve :) 

Once I seen who answered I knew that ticket was coming out of blocked haha :D

Perfect mate thanks, I’ll add it to my VR example list :P  

I wanted to split it out as you suggested to get the individual errors above the fields, plus they can be approved at different times potentially, but unlikely,

Thanks again

JR