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
EtauEtau 

VALIDATION RULE

Hi - I am trying to write a validation rule where an error will come up if the start date is less than today, but the stage cannot be credit memo issued:

 

AND(Start_Date__c <  Today(), ISPICKVAL(NOT( Opportunity.StageName, "Credit Memo Issued"))

 

Any thoughts on what is wrong with my formula?

 

Thanks

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

Are you getting an error message or is your VR not executing?  

Also, which object the VR being run on?  

If it's being run on the Opportunity Object itself you can reference the StageName field directly without the Opportunity object reference.  It also looks like your ISPICKVAL might be backwards.  

Try something like this   

 

AND(
Start_Date__c <  Today(), 
NOT(ISPICKVAL(StageName, "Credit Memo Issued"))) 

 

 

 

 

All Answers

Steve :-/Steve :-/

Are you getting an error message or is your VR not executing?  

Also, which object the VR being run on?  

If it's being run on the Opportunity Object itself you can reference the StageName field directly without the Opportunity object reference.  It also looks like your ISPICKVAL might be backwards.  

Try something like this   

 

AND(
Start_Date__c <  Today(), 
NOT(ISPICKVAL(StageName, "Credit Memo Issued"))) 

 

 

 

 

This was selected as the best answer
EtauEtau

Thanks Stevemo.  That worked

Steve :-/Steve :-/

No problem, you owe me a beer

EtauEtau

I'll buy you a case if you help me with another one (I'm serious).

Steve :-/Steve :-/

It's a deal!  

Although I must warn you, I like to drink these ->  

http://beeradvocate.com/beer/profile/863/7971

 

EtauEtau

OK - I'll give you my scenario  - Do you have access to the pub/store to pick it up?

 

I need to create a Royalty Date for an invoice register/royalty report.  This will be on the opp. product level.

 

My fiters:

 

Start date < today

Studio is not null

Invoice Date is not null

 

Populate a field called Royalty Date with the last day of the current month and then make that date permanent.  Any chance this is possible?

Steve :-/Steve :-/

It definitely sounds possible given the relationships of the Fields and the fact that they all reside on the Opportunity object.  The only tricky part that I see is the "LAST day of the month" and how to deal with a Leap Year February.  

 

As for the Pliny, that's gonna be a LOT harder to fix.  I'm located in Boston and they don't ship it anywhere near here (Russian River Brewery is out of Santa Rosa, CA).  

http://www.russianriverbrewing.com/

 But if you you're going to Dreamforce '11 you're buying!

 

EtauEtau

I am going and I will buy...Anything you like out of Boston?  Not sure I really care about the leap year at this point since it's not till 2012.

Steve :-/Steve :-/

Okay, lemme take a crack at it

EtauEtau

Thanks - hope you had a nice Christmas - I hear you got a lot of snow

Steve :-/Steve :-/

Okay you might want to try something where you evaluate the Month, and then return the MAX Date for that month, like this (but again you're gonna have to work-around Leap Years). 

 

Datatype: Formulal(Date)

Formula:

 

DATE(
YEAR(Date_1__c),
MONTH(Date_1__c),
CASE(MONTH(Date_1__c), 1, 31,
2,28,
3,31,
4,30,
5,31,
6,30,
7,31,
8,31,
9,30,
10,31,
11,30,
12,31,
0))

 Now when do I get my beer?!?

 

EtauEtau

Thanks Stevemo-

 

Here is my date formula (Roy_Date__c):  IF(AND(ISPICKVAL( Opportunity.Invoice_Sent__c, "Yes") , Start_Date__c < today(), Auto_Studio_France__c <>" "), today() , Null)

 

When I plug into your formula I get:

 

Error: Compiled formula is too big to execute (18,826 characters). Maximum size is 5,000 characters

 

I give Up!!  But I'll still buy you a beer!  Thanks for all of your time.

Steve :-/Steve :-/

Yikes!  18,000 charachters...  okay, you didn't tell me that some of those fields are Formulas themselves.  

I could tell you to try to trim down your code, but trying to go from 18,000+ to under 5,000...  oof!

Steve :-/Steve :-/

What if you tried to create a WFR that evaluates the record ad then sets the date with a Field Update? 

EtauEtau

You're Brilliant!  Thanks so much and have a great New Year.  Wish I could buy you that beer.

 

Ellen

Steve :-/Steve :-/

Well, there's always Fed-Ex and UPS  ;-)

EtauEtau

Send me your address and preference and it's on its way...My boss even said she'd pay.

Steve :-/Steve :-/

Awwww... thanks, but you guys don't have to do that (honest)  

 

but if you insist, where are you guys located?  I'll take any Local Micro-Brew (I'm a big I.P.A. fan)