Next, a quick search of the Customers module (API name of “contacts”, yes, it’s confusing lol) for customers with the same email as our CRM Contact.
If it finds a Customer with that email, we attach the Invoice to that Customer and pull the Contact Person information for our email.
If our search turns up empty (i.e. there is no Customer record in Books that matches that email) we first create that record before pulling the Contact Person information for the Invoice. This is the “if…else” code from lines 23-56.
Next, we create the map to populate the Invoice. Put in the Contact Person’s information, the invoice line items, and the payment options. More details on the actual Invoice creation is found here.
Quick note: if you created custom fields for your invoice and have trouble adding them to a record (like we did), look at our other Zoho Books Custom Fields repository for help.
Comments