Can't Get "For Each" action to work through my list of Project milestones

Can't Get "For Each" action to work through my list of Project milestones

I have created a function in the CRM that will update project details and all the milestones and tasks associated with that project when a particular trigger is actioned.

I am trying to work through a list of milestones associated with a particular project and update the start and end date for all the milestones that are returned from the GetRecords search.

I initially kept getting the following error:

Argument type mismatch - Found 'TEXT' but Expected '[BIGINT]' for the function 'get' 

varProjectID = projectID;
response = zoho.projects.getRecords("mafiprojects",varProjectID,"milestones");
info response;
//Update the start and end date for each milestone based on the date used. 
for each  milestone in response
{
thisMilestoneInfo = Map();
thisMilestoneInfo.put("name",milestone.get("name")); - this is the line it doesn't like.
thisMilestoneInfo.put("start_date",milestone.get("start_date"));
thisMilestoneInfo.put("end_date",milestone.get("end_date"));
thisMilestoneInfo.put("start_date",milestone.get("start_date"));
thisMilestoneInfo.put("start_date",milestone.get("start_date"));
updateMilestone = zoho.projects.update(("ourprojectportal",varProjectID,"milestones",thisMilestoneID,thisMilestoneInfo);

}

I found an article yesterday saying that for projects I have to add in the number of the record in the search results. Unfortunately I can't find the article again (and yes I've searched my history), but I did add that in as a hard coded number as per their example and that does work. 

thisMilestoneInfo.put("name",milestone.get(0).get("name"));

That works for that particular record, but I can't figure out how to step through all the records and have that "0" be dynamic. 

So I guess I don't understand why the "for each" won't work as it usually does and then I also can't figure out how to increment the record that its taking action for. 

I hope that makes sense. Basically I just need to be able to step through each record and update that record in Projects but I can't seem to make it work. 

I've really dumbed down my code so yes I know there is more to do, but I would love some help as to why it's doing this and how to fix it. 

Thanks so much.








                            Zoho Desk Resources

                            • Desk Community Learning Series


                            • Digest


                            • Functions


                            • Meetups


                            • Kbase


                            • Resources


                            • Glossary


                            • Desk Marketplace


                            • MVP Corner


                            • Word of the Day



                                Zoho Marketing Automation
                                        • Sticky Posts

                                        • Auto-update the Successor Task Status.

                                          Hello folks! We have come up with a new use case for custom function to help you automate the workflow of your tasks. Users can write their own Custom Functions using deluge and call them from a workflow. Consider a scenario where the status of the successor
                                        • Collaborate Visually with Whiteboard in Zoho Projects

                                          Whiteboard in Zoho Projects allows you to collaborate visually by creating diagrams, annotating designs, and sketching project workflows using shapes, text, and images within project modules. Team members can work simultaneously, improving productivity
                                        • Introducing Projects 8.0 - Focusing on Ease-of-Use and New Features

                                          Hello everyone! It's time for the reveal of the 8th version of Zoho Projects! This year our focus has been on minimizing the learning curve and improving the ease-of-use of the tool, so anyone new to Projects can hit the ground running and existing users
                                        • Manage Documents with SharePoint Extension in Zoho Projects

                                          SharePoint is a digital platform to store and manage your documents. Multiple users can work on the same document simultaneously, which enhances your team's productivity. By installing the extension in Zoho Projects, users can access the documents seamlessly
                                        • Work agile in Zoho Projects! The much-awaited Zoho Sprints integration is in the making.

                                          Let your teams work in both classic and agile methodology using our integration with Zoho Sprints. We made sure you get the best of both worlds with this integration. You can scale through teams irrespective of what methodology they use and make sure they work with speed and flexibility. And, you can do it all from one place- Zoho Projects.  Why this integration is a benefit?  This integration mostly helps in managing classic and agile practices together. Most organizations use a mix of both classic


                                        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 WorkDrive Resources



                                                                  Zoho Campaigns Resources

                                                                    Zoho CRM Resources

                                                                    • CRM Community Learning Series

                                                                      CRM Community Learning Series


                                                                    • Tips

                                                                      Tips

                                                                    • 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