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
JaxBeachJaxBeach 

Need help with a conditionally required validation rule

I have a field called Bid_Specification__c which I need to be required on the object only for new records so I was thinking I could use if the created date is null. 

 

However, this is a custom object and I just noticed there is no created date field.  I don't know why but I would have thought this would be part of the initial field creattion when I created this object such as created by, record owner, etc.

 

Do I need to create a custom field called Created Date and does the validation rule run prior to saving it so it will recognize that the created date is null?

 

Not sure of the syntax for this formula either.  Any help is much appreciated.  thanks. :-)

Best Answer chosen by Admin (Salesforce Developers) 
JFraileJFraile
The exact syntax is
ISPICKVAL(Bid_soecification__c , "") && ISNEW()

All Answers

JFraileJFraile

Hi.

 

Use the formula "NEW()" when creating you validation rule. It checks whether the record is being created.

Should look similar to this: " Bid_Specification__c = '' && NEW() "

JaxBeachJaxBeach

Sorry this took awhile to respond.  We tried the formula

 

Bid_soecification__c = "&&NEW()" but got an error message.  I failed to mention that Bid spec field is a text picklist field.  Is there an argument missing though?  shouldn't it be bid spec = 0 or false or null?  I'm not sure how to reword it for a picklist value too.  We tried ISPICKVAL(Bid_Spedification__c = "&&NEW()" but got some sort of boolean error that it was expecting a different result.  Thanks.

JFraileJFraile
The exact syntax is
ISPICKVAL(Bid_soecification__c , "") && ISNEW()
This was selected as the best answer
JaxBeachJaxBeach

Thanks so much - it worked great :-)