Deluge - passing collection values from for each loop to updateRecord

Deluge - passing collection values from for each loop to updateRecord

Hi,

I'm a newcomer to Deluge and am really struggling to get the below script to work.

I want it to use a for each loop to look through several fields on the Account record, and then, assuming there is a value in the field, user the proper function to capitalise it, and then update the record. So if the street name value is 'example street' the script corrects it to 'Example Street'.

But each time I am getting the message; Argument type mismatch - Found 'COLLECTION' but Expected '[MAP]' for the zoho.crm.updateRecord.

// get the Account Record
accountsCase = zoho.crm.getRecordById("Accounts",account_id);

// get the fields I want to run through the for each loop
accountName = accountsCase.getJSON("Account_Name");
postCode = accountsCase.getJSON("Billing_Code");
billStreet = accountsCase.getJSON("Billing_Street");
billProv = accountsCase.getJSON("Billing_Province");
billStreet2 = accountsCase.getJSON("Street_2");
billCity = accountsCase.getJSON("Billing_City");
addressColl = Collection(accountName, billStreet, billStreet2, billCity, billProv, postCode);

finalDetails = Collection();
for each data in addressColl
{
if(!isnull(data))
{
data = data.proper();
finalDetails.insert(data);
}
}
info finalDetails;
zoho.crm.updateRecord("Accounts",account_id,finalDetails);

    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns 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