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
brdbrd 

validation rule need for opportunity fields

Hi,

I need to write a validation rule for Opportunity Object. I have two standard field Stage and Probability.

 

Scenario:

 

When Stage= Plan is selected from the StageName picklist field the probability by default is 1% but user can edit this.

Now i have to write a validation rule for this in which i can restrict user so that they can enter only three values for stage=Plan manually. The values are 1%,0% and 2%. If user enters probabilty apart from this for the Stage=Plan then error has to be thrown. 

 

I am doing like this but this formula is not working:

 

IF(AND( ISPICKVAL(StageName,'Plan '), OR((Probability =0.01),(Probability=0),(Probability=0.02))),true,false)

 

Need help in this.

 

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
souvik9086souvik9086

Hi,

 

Try this

 

IF(AND( ISPICKVAL(StageName,'Plan'), NOT(OR((Probability =0.01),(Probability=0),(Probability=0.02)))),true,false)

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

All Answers

Yoganand GadekarYoganand Gadekar

Try this

AND( 
ISPICKVAL(StageName ,'Plan'), 
AND( 
Probability <> 0, Probability <> 2,Probability <> 1 

)

 

Hit kudos and mark this as answer if it helps you,

thanks,

TogopoBTogopoB

Hi there,

 

there seems to be a space in your picklist 'Plan ' besides that > you can remove the IF clause as the AND will return true or false.

souvik9086souvik9086

Hi,

 

Try this

 

IF(AND( ISPICKVAL(StageName,'Plan'), NOT(OR((Probability =0.01),(Probability=0),(Probability=0.02)))),true,false)

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

This was selected as the best answer
Yoganand GadekarYoganand Gadekar

you need not write IF here,

this too does the same thing,

 

AND( 
ISPICKVAL(StageName ,'Plan'), 
AND( 
Probability <> 0, Probability <> 0.02,Probability <> 0.01 

)