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
muneeswar umuneeswar u 

Only User - A or User - B should have the ability to close the Opportunity

Hi all,

I have a requirement, where Only User - A or User - B should have the ability to close the Opportunity record and the remaining users should be restricted to close the opportunity using validation rule.

My validation rule is working for a single user:

OR(AND( ISPICKVAL(StageName , 'Lost - No Decision') , (  $User.FirstName != 'A' ))  )

But I need a single validation for both the users:
OR(AND( ISPICKVAL(StageName , 'Lost - No Decision') , (  $User.FirstName != 'A' )) , AND( ISPICKVAL(StageName , 'Lost - No Decision') , ( $User.FirstName != 'B') ))

can anyone provide a solution?
Thanks .
VinayVinay (Salesforce Developers) 
Try below snippet.
 
AND( ISPICKVAL(StageName , 'Lost - No Decision') , (OR($User.FirstName != 'A' ),( $User.FirstName != 'B')))

Thanks,
muneeswar umuneeswar u
Hi Vinay, I have used the validation rule that you send , but its not working
VinayVinay (Salesforce Developers) 
Do you see any errors.  Can you re-check if the record is meeting the criteria?

Thanks,
muneeswar umuneeswar u
Hi It is throwing the same validation message for all the users. It's not working for any user. Can you please check from your side