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
Ash HallettAsh Hallett 

Opportunity Stage Validation Rule

Hey Everyone,

I'm completely new to Salesforce so I apologise for my lack of Apex knowledge in advance, I am signing up to all of the relevant courses as we speak......

I'm having trouble creating a validation rule that makes sure an option from a picklist must be chosen before the stage can be advanced to 'Proposal/Price Quote' stage.

Can anyone help?

 

Would really appreciate any information or suggestions people may have.

Thanks,

Ash

 

 

Best Answer chosen by Ash Hallett
Scott McClungScott McClung
silly mistake on my part...
The Stage field is also a picklist so we need to handle it in the same way we do the Router__c field.

These both do the same thing
AND (
 NOT(ISPICKVAL( Router__c, 'required option')), 
 ISPICKVAL( StageName, 'Proposal/Price Quote')
)

or

AND(
 NOT( TEXT( Router__c) = 'required option'), 
 TEXT( StageName ) = 'Proposal/Price Quote'
)


All Answers

kevin lamkevin lam
AND(NOT(ISPICKVAL(picklistName, "required option")),
         StageName = "Proposal/Price Quote")
Scott McClungScott McClung
...or if you're just trying to make sure that ANY value from the picklist is chosen before the stage can be changed...
AND (
 ISBLANK(TEXT(Picklist_Field_Name__c)),
 StageName = 'Proposal/Price Quote'
)


Ash HallettAsh Hallett

Hey Guys,

 

Appreciate your help and swift replies!

I have tried both methods but keep coming up against the same error message.... Any thoughts?

 

User-added image

Scott McClungScott McClung
silly mistake on my part...
The Stage field is also a picklist so we need to handle it in the same way we do the Router__c field.

These both do the same thing
AND (
 NOT(ISPICKVAL( Router__c, 'required option')), 
 ISPICKVAL( StageName, 'Proposal/Price Quote')
)

or

AND(
 NOT( TEXT( Router__c) = 'required option'), 
 TEXT( StageName ) = 'Proposal/Price Quote'
)


This was selected as the best answer
Ash HallettAsh Hallett

That's perfect!

 

Thanks a lot for your help Scott!