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
Myron FairMyron Fair 

DateCreated Validation Rule

I am trying to add a DateCreated to my validation rule. Without the added date piece, I receive a valid validation error, but when the datecreated piece is added I instead recieve error message: Upsert failed. First exception on row 0 with id a014B000006vdUXQAY; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please complete all Cyber Due Diligence questions!: [].
 
AND(
Due_Diligence_Status__c = "Not Requested",
DATEVALUE(CreatedDate) >= Date(2020,08,18),
OR(
ISBLANK(TEXT(Answer_Question_1__c)),
ISBLANK(TEXT(Answer_Question_2__c)),
ISBLANK(TEXT(Answer_Question_3__c)),
ISBLANK(TEXT(Answer_Question_4__c))
))

 
VinayVinay (Salesforce Developers) 
Hi Myron,

Above validation looks good,  can you share more details and can you check 'Please complete all Cyber Due Diligence questions' existing validation rule as well?

Thanks,
Vinay Kumar
Myron FairMyron Fair

Vinay,

My question revolves around the type of validation error messages produced. When I leave the DateCreated portion out of the validation rule, the error is simply what I define it to be such as: Please complete the required fields before saving record. 
When I add the DateCreated portion the error message includes what is listed in the above post. I'm not sure if that is correct or not. That's why I was thinking that my formula was off in some area. 

Please advice and thank you for the response. 

Abhishek BansalAbhishek Bansal
Hi Myron,

It looks like you have a custom VF page and you are trying to show the validation on that page. If this is the case, then you need to add try and catch block in your save method. In the catch block, capture the error message and show it in a proper format on VF page.
Let me know if you need any other help or information on this.

Thanks,
Abhishek Bansal.
Myron FairMyron Fair
Abhishek,

There is no known VF page. I am creating this validation rule directly within the objects validation rule section. I'm just not sure why the messages would differ tremendously when the date is not used and when it is. 

Thanks,
Myron Fair
Abhishek BansalAbhishek Bansal

Hi Myron,

Hard to figure out whats going wrong here. It would be good if you are able to coonect on a call. I am available on:
Gmail: abhibansal2790@gmail.com
Skype: abhishek.bansal2790

Thanks,
Abhishek Bansal