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
Thomas Smith 61Thomas Smith 61 

System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Contract_End_Date__c]: [Contract_End_Date__c]

This for -
How to Code for Creating Validation Rule Challenge?

Rule needed - To complete this challenge, add a validation rule which will block the saving of a new or updated contact if the contact is related to an account and has a mailing postal code (which has the API Name MailingPostalCode) different from the account's shipping postal code (which has the API Name ShippingPostalCode).
Name the validation rule Contact must be in Account ZIP Code
A contact with a MailingPostalCode that has an account and does not match the associated Account ShippingPostalCode should return with a validation error and not be saved
The validation rule should ONLY apply to contact records with an associated account. Contact records with no associated parent account can be added with any MailingPostalCode value. (Hint: you can use the ISBLANK function for this check)
What I have:
AND( NOT(ISBLANK(AccountId)), MailingPostalCode != Account.ShippingPostalCode )

Error I am getting-
Challenge not yet complete... here's what's wrong:
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Contract_End_Date__c]: [Contract_End_Date__c]

Unsure - I have the object Contract_End_Date__c (I have put it in ojects as a field for Account, Contact and Contract put it in all because i couldnt figure out the why?) and it is Required Field.

Thank you in advance,
Tom Smith
 
Best Answer chosen by Thomas Smith 61
Raj VakatiRaj Vakati
Deactive the Contract_End_Date__c  validation and then try to check the challenge .. 


Salesforce is trying to insert the data on click of the challenge .. that is causes an conflict with this validation 

All Answers

Raj VakatiRaj Vakati
Deactive the Contract_End_Date__c  validation and then try to check the challenge .. 


Salesforce is trying to insert the data on click of the challenge .. that is causes an conflict with this validation 
This was selected as the best answer
Thomas Smith 61Thomas Smith 61
Raj V, I don't have any validations on Contract_End_Date__C. 

I keep looking and did not miss making one but when I look at the Objects under Accounts, Contacts, and Contracts - they have under Field & Relationships Contract_End_Date__c from previous Traning Trail - 

It looks like it is saying that it can find that Required Field?

thanks  
Thomas Smith 61Thomas Smith 61
Well Rav V,

Thanks for the Advice - I just when ahead a deleted all Contract_End_Date__c from all Objects and it Worked - 15mins turned into 2.5hrs.. 
Ramgopal Nannapaneni 6Ramgopal Nannapaneni 6
all you need to do is that go to Contract object=>fields =>Edit=>Contract_End_Date__c
uncheck the required this field,
it will work