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.