You need to sign in to do that
Don't have an account?
Lakshmi Kumar 7
Hi,
I am new and learning Apex Development. We have a Developer interview and we are planning to ask him/her to code for the below-mentioned question.Can somebody show me how the code should look like and how can we check the solution for this?
Thanks!!
Apex Code to check if there is an existing contact that matches first name + last name + email address
Hi,
I am new and learning Apex Development. We have a Developer interview and we are planning to ask him/her to code for the below-mentioned question.Can somebody show me how the code should look like and how can we check the solution for this?
Question: For a given contact record, check if there is an existing contact that > matches first name + last name + email address?
Thanks!!
Please try the code below. To test it you could call the static match method from Execute Anonymous, with the "given Contact record" as the parameter. It would return true if there was a match, false if not.
If you're testing with a Contact record already in the database (as opposed to a Contact record you allocate in EA but do not insert), the Id !=: c.Id clause will prevent counting that record itself as a match.
Hope this helps.
Please mark this as solved if it's resolved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.
Best Regards,
Nagendra.
Am I not doing this right? We are testing with contact record that already exists in the DB.
Thanks!!!