How to create zoho books contact from zoho crm custom function

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:
  1.         contactperson = Map();
  2. contactperson.put("first_name",fName);
  3. contactperson.put("last_name",lName);
  4. contactperson.put("email",email);
  5. contactperson.put("phone",phone);
  6. billingAddress = Map();
  7. billingAddress.put("attention",fName + " " + lName);
  8. billingAddress.put("address",street);
  9. billingAddress.put("city",city);
  10. billingAddress.put("state",state);
  11. billingAddress.put("zip",zip);
  12. booksContactInfo = Map();
  13. booksContactInfo.put("contact_name",fName + " " + lName);
  14. booksContactInfo.put("contact_persons",contactperson);
  15. booksContactInfo.put("currency_id",3474557000000000097);
  16. booksContactInfo.put("billing_address",billingAddress);
  17. booksContactInfo.put("tax_authority_id",3474557000000360005);
  18. booksContactInfo.put("tax_id",3474557000000360007);
  19. booksContactInfo.put("is_taxable",true);
  20.          response = zoho.books.createRecord("Contacts","788939832",booksContactInfo,"zoho_books_create_update");

  21. info response;
  22. booksID = response.get("contact").get("contact_id");
  23. 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!

    Access your files securely from anywhere







                            Zoho Developer Community




                                                  • Desk Community Learning Series


                                                  • Digest


                                                  • Functions


                                                  • Meetups


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner


                                                  • Word of the Day


                                                  • Ask the Experts



                                                            • Sticky Posts

                                                            • Free Webinar - Digital signatures for digital contract management with Zoho CRM

                                                              Hi, Did you know you can seamlessly send and collect signatures on important business documents like business proposals, vendor agreements, sales contracts, invoices, and other inventory documents with Zoho Sign’s extension for Zoho CRM? Join our upcoming
                                                            • New User Interface for your Email integration in Zoho CRM

                                                              Hello folks,  As most of you may already know, Zoho Mail recently got a new user interface that's a lot better and easier to use. As a result, this change will affect your email integration with your Zoho CRM account**.  If you have your email integration in Zoho CRM set up through POP, your Emails UI in CRM will be moved to the new Zoho Mail UI. We hope that you like the new and improved Emails interface inside Zoho CRM. Feel free to share your feedback by commenting below.  **Please note that,
                                                            • Fetching leads from Zoho CRM into Zoho Creator, automatically

                                                              I'd like to pull new leads from the CRM system, into Creator, on a daily basis. Is this possible?   Yes, it is possible. Zoho Creator and Zoho CRM are integrated with each other, enabling you to synchronize data between them. This is done by fetching records from CRM into a Zoho Creator form. In order to achieve this, you'll have to configure a workflow alert in Zoho CRM.  For instance, you can maintain the lead details in CRM on a separate form in Zoho Creator by fetching the details automatically


                                                            Manage your brands on social media



                                                                  Zoho TeamInbox Resources



                                                                      Zoho CRM Plus Resources

                                                                        Zoho Books Resources


                                                                          Zoho Subscriptions Resources

                                                                            Zoho Projects Resources


                                                                              Zoho Sprints Resources


                                                                                Qntrl Resources


                                                                                  Zoho Creator Resources



                                                                                      Zoho CRM Resources

                                                                                      • CRM Community Learning Series

                                                                                        CRM Community Learning Series


                                                                                      • Kaizen

                                                                                        Kaizen

                                                                                      • Functions

                                                                                        Functions

                                                                                      • Meetups

                                                                                        Meetups

                                                                                      • Kbase

                                                                                        Kbase

                                                                                      • Resources

                                                                                        Resources

                                                                                      • Digest

                                                                                        Digest

                                                                                      • CRM Marketplace

                                                                                        CRM Marketplace

                                                                                      • MVP Corner

                                                                                        MVP Corner









                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now


                                                                                            Zoho Show Resources

                                                                                              Zoho Writer

                                                                                              Get Started. Write Away!

                                                                                              Writer is a powerful online word processor, designed for collaborative work.

                                                                                                Zoho CRM コンテンツ



                                                                                                  Nederlandse Hulpbronnen


                                                                                                      ご検討中の方