Updating customer shipping address via Zoho Inventory API

Updating customer shipping address via Zoho Inventory API

My client is looking to add a functionality that will allow Zoho inventory to automatically update the City, State and Country fields on a customer record based on a zip code that they've entered. For example - if they enter 92705 as a zip code (US zipe code) the system will automatically update the following: City: Santa Ana, State: California, Country: United States

I was able to write a custom function that looks at the customer record, and calls the google maps API to retrieve the City, State and Country. I'm able to retreive the data i need from google maps API but running into an issue when trying to take the values i retrieved and update the customer shipping address. Below is the code i've used which doesn't work:

city = address.get(1).getJSON("long_name");  //parsing the Jason I received from google

state = address.get(3).getJSON("long_name");  //parsing the Jason I received from google

country = address.get(4).getJSON("long_name"); //parsing the Jason I received from google

mp = Map();  //declaring the response variable

mp.put("shipping_address[city]",city);

mp.put("shipping_address[state]",state);

mp.put("shipping_address[country]",country);

update = zoho.inventory.updateRecord("Contacts",organizationID,customerID,mp);


Looking at the JSON format I get using the GET command for a customer it seems like Shipping_address is on a nested level in the JSON (see attached file). I'm trying to figure out the correct syntax to update the shipping address. Any guidance/direction will be much appreciated! 
    • Sticky Posts

    • Function #41: Sync Associated Subforms!

      Welcome back everyone! The last custom function showed how to update a Contact with Product details from it's Related list in Deals. This week, let's look at a function that lets you update subform records in two modules simultaneously when one of them is updated. Business scenario Let's look at how subform helps in an education institution that has deployed Zoho CRM. National Public School, Austin (made up, of course!) has set up Zoho CRM and it follows the same relationship pattern of "Students",

      Zoho SalesIQ Resources



            Zoho TeamInbox Resources

              Zoho DataPrep Resources


                  Zoho CRM Plus Resources

                    Zoho Books Resources


                      Zoho Subscriptions Resources

                        Zoho Desk Resources

                          Zoho Projects Resources


                            Zoho Sprints Resources


                              Qntrl Resources


                                Zoho Creator Resources


                                  Zoho WorkDrive Resources




                                      Zoho Campaigns Resources

                                        Zoho CRM Resources

                                                    Design. Discuss. Deliver.

                                                    Create visually engaging stories with Zoho Show.

                                                    Get Started Now


                                                      Zoho Show Resources


                                                        Zoho Writer Writer

                                                        Get Started. Write Away!

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

                                                                  有料プランをご利用の方