Hi,
then I would not alter this method. It’s a core method and there are upgrade-safe ways of accomplishing this validation.
If you would like to have a direct response (while the user is filling in the form), you could:
- embed a javascript listener in the EditForm that calls an entrypoint with the current phone number (you have to create this entrypoint first). Within the entrypoint, you validate if the phone number is already in use, and if so, you can create an alert or any other notification you would like to see (you can also create error messages that look like the suite ones)
A “backend” approach instead (works therefore also when creating contacts via API):
- an easier approach: you create a before-save-hook. Every method defined as before-save-hook will be triggered whenever a user is trying to create a record of that module. From there, you can do the same validations and also interrupt the save-process.
Both approaches require some suite-knowledge, hopefully these articles help you get going:
E: within the entrypoint or within a logichook, you should not use direct db queries. Instead, use the bean framework: