+ Start a Discussion

Opportunity Product Validation

Can anyone help me out  on this requirement ?how to achieve it?I shall appreciate your help.

I want to create a validation rule at Opportunity product to validate the following.
1)Opp record Type – sample
2)And Stage not equal to ‘Pending Approval’
3)Product or product code(item number) ends with -22 or -23 or -24
Then you it should give the following error message.
When requesting samples for 130 Lumen parts, stage should be pending approval
PratikPratik (Salesforce Developers) 
Hi Nikkey,

The Sample Rule created and tested:

AND (NOT (ISPICKVAL(Opportunity.StageName,"Pending Approval")), 
Opportunity.RecordTypeId = "01290000000hPtK" , 
OR ( IF (RIGHT(Product2.ProductCode,2)==TEXT(20),True,False ), IF (RIGHT(Product2.ProductCode,2)==TEXT(60),True,False ) ) )

Now As per your requirement:
1. Put RecordtypeId for Sample. Go to Opportunities->Recordtype->Click on Smaple Recordtype, in the url in browser you will find ID, copy the same.
2. Stagename, I have already put it.
3. Product code: As per you requirement, change it to like
     RIGHT(Product2.ProductCode,3)==TEXT(-22) and likewise.


P.S. If this answers you question, please mark it as "Best Answer" so it will help other community members too.