Custom function: Form subform entries to related list records

Custom function: Form subform entries to related list records

Hello,

I'm looking to code a function for the following scenario:

We send our client a Zoho Forms. In the Forms, theres is a subforms asking for that clients' partners (Name, email, phone, role, screenshot). This subform is linked to a subform in zoho crm's Deals module.

We want a function to create a contact for each of the subform entries and link all of them with the Deals record through the "Contact Roles" related list.

How would we do this?

The API names are:
Module: "Deals"
Subform: "Partner"
      First name: "First_name"
      Last name: "Last_name"
      Role: "Role"
      Email: "Email"

In the contacts module, the API names are:
Module: "Contacts"
First name: "First_Name"
Last name: "Last_Name
Email: "Email"

The function should verify if the contact already exists (unique field = Email). If so, then it should just associate the contact to the Deals through the Contact Roles related list.


Thank you!