Hello developers,
Within Espo CRM, I have established relations with multiple entities. Specifically, I need to establish links between entities when creating new records. To illustrate, let's consider the scenario where I have contacts without an associated email address or phone number. In this context, my objective is to enforce a requirement for a contact to be associated when creating a new opportunity. Additionally, I aim to implement a validation mechanism that prevents the creation of an opportunity linked to a contact lacking an email address or phone number. The idea is that the information in the contact should be completed before it can be used.
I have attempted to address this by using the following code snippet:
if (contact.emailAddress == null ) { recordService\throwBadRequest("Missing Email in contacts."); }
However, I am uncertain about the effectiveness of this code in achieving the desired outcome. Could you please provide guidance on how to achieve the specified functionality in a more effective manner? Your assistance would be greatly appreciated.
Within Espo CRM, I have established relations with multiple entities. Specifically, I need to establish links between entities when creating new records. To illustrate, let's consider the scenario where I have contacts without an associated email address or phone number. In this context, my objective is to enforce a requirement for a contact to be associated when creating a new opportunity. Additionally, I aim to implement a validation mechanism that prevents the creation of an opportunity linked to a contact lacking an email address or phone number. The idea is that the information in the contact should be completed before it can be used.
I have attempted to address this by using the following code snippet:
if (contact.emailAddress == null ) { recordService\throwBadRequest("Missing Email in contacts."); }
However, I am uncertain about the effectiveness of this code in achieving the desired outcome. Could you please provide guidance on how to achieve the specified functionality in a more effective manner? Your assistance would be greatly appreciated.
Comment