How to create zoho books contact from zoho crm custom function
Hi.
I am trying to create a zoho books customer from a zoho crm custom function.
I got it working, but it doesn't add in the contact information section (screenshot attached), just the billing or shipping address sections.
I think i need to add a contact persons in the request to make that happen. But when I try to do that I get this error:
- {"code":1038,"message":"JSON is not well formed"}
that error is from this code:
- contactperson = Map();
- contactperson.put("first_name",fName);
- contactperson.put("last_name",lName);
- contactperson.put("email",email);
- contactperson.put("phone",phone);
- billingAddress = Map();
- billingAddress.put("attention",fName + " " + lName);
- billingAddress.put("address",street);
- billingAddress.put("city",city);
- billingAddress.put("state",state);
- billingAddress.put("zip",zip);
- booksContactInfo = Map();
- booksContactInfo.put("contact_name",fName + " " + lName);
- booksContactInfo.put("contact_persons",contactperson);
- booksContactInfo.put("currency_id",3474557000000000097);
- booksContactInfo.put("billing_address",billingAddress);
- booksContactInfo.put("tax_authority_id",3474557000000360005);
- booksContactInfo.put("tax_id",3474557000000360007);
- booksContactInfo.put("is_taxable",true);
- response = zoho.books.createRecord("Contacts","788939832",booksContactInfo,"zoho_books_create_update");
- info response;
- booksID = response.get("contact").get("contact_id");
- info booksID;
If I comment out the contact persons stuff it created the contact but without the primary contact information section. I attached a screenshot
This seems similar to a lot of things I have done in the past that have worked.
I would appreciate any insight. Thanks so much in advance!