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
Sara Phillips 1Sara Phillips 1 

New to Apex Code - trying to Update or Delete Existing Apex Receiving Invalid Data Error: FIELD_CUSTOM_VALIDATION_EXCEPTION

Hi Everyone,

I am new to code and the new Salesforce Administrator foe my company. How do I revise Apex code to include additional lookup for allowed contact based on record type? I would also consider deleting it altogether.

Here is the full error message users are receiving.
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger DealCorrespondenceNoteTrigger caused an unexpected exception, contact your administrator: DealCorrespondenceNoteTrigger: execution of AfterInsert caused by: System.DmlException: Update failed. First exception on row 0 with id a062K00001xpI1TQAU; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Only Contacts from the Account in the Deal Correspondence record are allowed.: [Contact__c]: Class.DealCorrespondenceNoteManager.DealCorrespondenceUpdateNote: line 13, column 1


Thank you for any help you are able to provide. Please advise if additional details are necessary.
Best Answer chosen by Sara Phillips 1
KrishnaAvvaKrishnaAvva
Hi Sara,

Please navigate to Contact object - validation Rules and search for "Only Contacts from the Account in the Deal Correspondence record are allowed" to modify the validationrule/formula.

All Answers

KrishnaAvvaKrishnaAvva
Hi Sara,

Please navigate to Contact object - validation Rules and search for "Only Contacts from the Account in the Deal Correspondence record are allowed" to modify the validationrule/formula.
This was selected as the best answer
Sara Phillips 1Sara Phillips 1
Thank you so much for your help, Krishna.Awa