You need to extend PrimartContactGraphExt, and implement your check there.
using PX.Data;
using PX.Objects.CR;
namespace StackOverFlowDemo
{
// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public class PrimaryContactGraphExtExt : PXGraphExtension<BusinessAccountMaint.PrimaryContactGraphExt, BusinessAccountMaint>
{
protected virtual void _(Events.RowPersisting<Contact> e)
{
if (e.Row?.IsPrimary != true) return;
if (e.Row.EMail == null)
{
// Acuminator disable once PX1050 HardcodedStringInLocalizationMethod [Justification]
e.Cache.RaiseExceptionHandling<Contact.eMail>(e.Row, e.Row.EMail,
new PXSetPropertyException<Contact.eMail>("Email address must not be empty for primary contacts.", PXErrorLevel.RowError));
}
}
}
}