Hi All, I hope to get some help here from veterans of ESPO CRM. I am newest to ESPO and just trying to get my head around it. I have created an entity (of the type base plus) and trying to have an email type field in this entity. I have gone through the documentation and looks like ESPO says email type field CANNOT be created directly, am wondering if anyone could point me to how it can he created indirectly. Anything will be much appreciated. Thanks.
Announcement
Collapse
No announcement yet.
Creating Email type field
Collapse
X
-
Welcome to the forum etc, etc.
Yes that right, there is still no "hold my hand" guide to make this type of field yet. The closest I can find is this thread here: https://forum.espocrm.com/forum/deve...mail-and-phone
Indirectly method would just be create an entity, maybe something like "EmailCustom", then link two entity together by using Entity relationship. Not ideal but it would work (See: https://docs.espocrm.com/administrat...#relationships )
Second method is to do similar above and use a paid for extensions which would allow you to do the above but link it in a more pleasing to the eyes way. (From Elba Soft)
---
With that said, here is my advertisement: https://github.com/o-data/EspoCRM-Le...nd-Design/wikiLast edited by esforim; 10-07-2021, 07:58 AM.
-
Hi, you can do this easily via backend - whenever desired field will not be in email format (and not empty of course), EspoCRM will throw error to the user:
PHP Code:private function validateEmailField(Entity $entity): void
{
$emailField = $entity->get('title');
if(!filter_var($emailField, FILTER_VALIDATE_EMAIL) && $emailField != null)
{
throw new Error('The input provided in field in not valid email.');
}
}
Comment
Comment