I am working on a requirement to check the Lead/Contact email address, against the email address on a separate custom object named "Do not call Log'. For example, if the email address of email@example.com exists in the email field, on the "Do not call Log" object a user should not be able to create a new Lead/Contact with that same email address. The user should get an error message stating that 'Email address already exists…" I was thinking of creating a flow to run a loop over the "Do not call log" object to check if that email already exists, however, I can't determine a way to get a message to the user upon trying to save the lead/Contact record. Does anyone have any suggestions or thoughts? Should this be done via Apex?
You cannot add errors to records with flow. You can use an Apex trigger and the SObject.addError method to add an error message and prevent the DML from occurring.