HI, how did you solve that?
thanks
Unique field error
Collapse
X
-
I am using the duplicate check also for the e-mail address. Can I get a lock so I can't save the record?Leave a comment:
-
Hello,
I solved now it works fine, but when I create a lead and not when I change it.
Can I insert the alert also in edit? If so, how can I do it?
ThanksLeave a comment:
-
the Lead.php file was created here: espocrm/custom/Espo/Custom/ServicesLeave a comment:
-
Hi, sorry unfortunately the Google translator helps a lot but not enough. I didn't understand what you'd like to see
ThanksLeave a comment:
-
Where did you place this file? give me absolute path or relative path from espocrm folder. Also Go to Administration > click on clear cache
and retry once -
Hi, this is the file
Thanks
PHP Code:namespace Espo\Custom\Services; use Espo\ORM\Entity; class Lead extends \Espo\Modules\Crm\Services\Lead { protected function getDuplicateWhereClause(Entity $entity, $data) { return array('partita_iva' => $entity->get('partita_iva')); } }
Leave a comment:
-
Hello, thank you for having responded.
I tried how you wrote, but when I try to save a lead it gives me this error:
Errore 500: Class '\Espo\Custom\Services\Lead' does not exist.
[2019-09-26 18:42:14] Espo.ERROR: (500) Class '\Espo\Custom\Services\Lead' does not exist.; GET /api/v1/Lead?select=salutationName%2CfirstName%2ClastName% 2Cname%2Cstatus%2CaccountName%2CemailAddressIsOpte dOut%2CemailAddress%2CemailAddressData%2CassignedU serId%2CassignedUserName%2CcreatedAt&maxSize=100&o ffset=0&orderBy=createdAt&order=desc; line: 116, file: /var/www/html/espocrm/application/Espo/Core/ServiceFactory.php
Could you give me some suggestions?
Thank you very muchLeave a comment:
-
espocrm/custom/Espo/Custom/Services/<Your-Entity>.php where <your-entity> is like Lead
PHP Code:namespace Espo\Custom\Services; use Espo\ORM\Entity; class Lead extends \Espo\Modules\Crm\Services\Lead { protected function getDuplicateWhereClause(Entity $entity, $data) { return array('vat' => $entity->get('vat')); } }
your extends <class> depends on what entity it is.
If you check espocrm/application/Espo/Modules/Crm/Services there will be a file called Lead.php. That's why I can extend it. If you don't know what to extend with, just check espocrm/application/Espo/Modules/Crm/Services path first to see if there is a file corresponding to <your-entity>, otherwise extend below metioned class
\Espo\Services\Record
which points to espocrm/application/Espo/Services/Record.php fileLast edited by theBuzzyCoder; 09-19-2019, 11:56 AM.Leave a comment:
-
he means the error message that appears when you try to save new entity with an already exist unique field value, catching the error and make it friendly -
Your question is unclear. Are you asking for a duplicate check of field values? Can you elaborate your question with screenshots if possible -
Thank you now it works, you have been very kind.
There is only one problem, if the field already exists from error 500, how can I display a personalized message as "VAT number already present"
Thanks againLeave a comment:
Leave a comment: