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

help with Validation rule on Opportunity object to change date when stagename is changed

I am trying to create a validation rule that when the StageName changes to Invoice it checks and make sure the CloseDate is today's date. Below is my formula. The problem is when any of the other fields are changed in this opportunity it still populates with Today's date. I don't want it do that. 



OR(IF(ISPICKVAL( StageName, "Invoice"), NOT(CloseDate = TODAY()), null),
IF(ISPICKVAL(StageName, "Invoice Supplies"), NOT(CloseDate = TODAY()), null))



Also I tried to setup a workflow rule. But same thing is happening.


Field Update:Opportunity.CloseDate

Formula Value: Today()

Workflow rule: Everytime a field is updated or created

Rule criteria = Invoice




I believe this could be handle with this as your validation rule:


ISPICKVAL( StageName, "Invoice"), 
ISPICKVAL( StageName, "Invoice Supplies")
CloseDate <> TODAY()
Is the close date field updating to TODAY() based on another workflow rule? I can't tell from your question if the rule works all the time, or never works.  I am also confused if you are looking for a validation rule or a workflow rule to update close date to TODAY() if Stage = Invoice or Invoice Supplies. 



This is what I had initially. The problem is if I go back and update a another non-related field after it has been invoiced. It asked me to update the close date with today's date. I don't want it to change the close date if I am changing another field.


In regards to workflow rule, I was just wondering if a workflow is better to use than validation. Alll I am trying to achieve is the CloseDate changes to Today's date when stage is set to Invoice.


Does that make sense?