Update Task API Limit Issue
I am running into issues with the API limit for update task in Zoho Projects.
In a typical Project, we have 120-130 Tasks and I would like a field change made to the Project to propagate down to all Tasks that belong to the Project. (In this case "Territory). I am running the below function upon field change of Project.Territory to update Task.Territory.
Is there any reasonable way to get around the 100x API usage limit for this function?
- // Get all tasks for the specified project ID
- taskDetails = zoho.projects.getRecords(portalId,projectId,"tasks",0,0,"xxxxxxxxxx");
- tasksList = taskDetails.get("tasks");
- // Create a map to specify the custom field update
- customFieldsMap = Map();
- customFieldsMap.put("UDF_CHAR82",territory);
- // Create the main map and nest the custom fields map within "custom_fields"
- updateTaskParameter = Map();
- updateTaskParameter.put("custom_fields",customFieldsMap);
- //only run code if Project.Territory is not null
- if(territory != null)
- {
- // Loop through each task in taskDetails (Tasks belonging to projectId)
- for each task in tasksList
- {
- // Access the ID of each task and Territory (UDF_CHAR82)
- taskId = task.get("id");
- taskTerr = task.get("UDF_CHAR82");
- //Check if Task has subtasks
- taskisParent = task.get("isparent");
- // If Task has Subtasks get all Subtasks belonging to this Task
- if(taskisParent == TRUE)
- {
- subTaskResponse = invokeurl
- [
- url :projectsAPIEndPoint + "/portal/" + portalId + "/projects/" + projectId + "/tasks/" + taskId + "/subtasks/"
- type :GET
- connection:"xxxxxxxxxx"
- ];
- //For each Subtask belonging to this task update Territory if not already matching
- for each subTask in subTaskResponse.get("tasks")
- {
- // Access the ID of each task and Territory (UDF_CHAR82)
- subtaskId = subTask.get("id");
- subtaskTerr = subTask.get("UDF_CHAR82");
- if(subtaskTerr.toString() != territory.toString())
- {
- subtaskUpdate = zoho.projects.update(portalId,projectId,"Tasks",subtaskId,updateTaskParameter,"xxxxxxxxxx");
- }
- }
- }
- // Perform the update operation if Task.Territory differs from Project.Territory
- if(taskTerr.toString() != territory.toString())
- {
- taskUpdate = zoho.projects.update(portalId,projectId,"Tasks",taskId,updateTaskParameter,"xxxxxxxxxx");
- }
- }
- }
- return taskUpdate;
