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
wcwill978wcwill978 

Validation Rule for Closing Opportunities

Can someone please help me with a validation rule that does not allow an opportunity to be marked closed lost unless its the Account owner closing it. We want to only allow the account owner to be able to close the opportunity if its lost. So far I have:

 

AND (
ISPICKVAL(StageName, "Closed Lost" ),

)

 

Now I dont know what to use to validate that the user closing it is the account owner, if its not the account owner than an error can be displayed: "only account owner can close this deal as lost"

 

Thanks in advanced.

Best Answer chosen by Admin (Salesforce Developers) 
Steve :-/Steve :-/

here you go

 

AND(
IsClosed = TRUE,
IsWon = FALSE,
 $User.Id <> Account.OwnerId )

you owe me a beer!

All Answers

Steve :-/Steve :-/

here you go

 

AND(
IsClosed = TRUE,
IsWon = FALSE,
 $User.Id <> Account.OwnerId )

you owe me a beer!

This was selected as the best answer
wcwill978wcwill978

thnx stevmo, i'll get you a beer at the next user group meeting I see we're both from the Boston Area.

wcwill978wcwill978

Now I'm trying to exclude all opportunities that the account record type equals "Partner". I tried:

 

AND(
IsClosed = TRUE,
IsWon = FALSE,
ISPICKVAL(Type, "Existing Customer - Service Renewal" ),
Account.RecordType <> "Partner"

)

 

 also have tried adding:

 

Account.Parent.RecordType <> "Partner",

 

and keep getting Error: Field RecordType does not exist. Check spelling. How can I add this exception to exclude opprtunities that their accounts have the partner record types.

Steve :-/Steve :-/

here you go 

 

AND(
IsClosed = TRUE,
IsWon = FALSE,
ISPICKVAL(Type, "Existing Customer - Service Renewal" ),
Account.RecordTypeId  <> "01250000000NXXX"
)

 

 

 

 

 

when do I get my beer???