getAssociatedTasksUrl = projectsDomain + "/api/v3/portal/" + portalId + "/projects/" + bugProjectId + "/bugs/" + bugId + "/associated-tasks";getAssociatedTasksParam = Map();getAssociatedTasksParam.put("sindex","0");getAssociatedTasksResp = invokeurl[url :getAssociatedTasksUrltype :GETparameters:getAssociatedTasksParamconnection:"xxxxxxxxxx"];info getAssociatedTasksResp;if(getAssociatedTasksResp != null && getAssociatedTasksResp.get("task_array") != null){getTaskLayoutUrl = projectsDomain + "/restapi/portal/" + portalId + "/projects/" + bugProjectId + "/tasklayouts";taskLayoutDetails = invokeurl[url :getTaskLayoutUrltype :GETconnection:"xxxxxxxxxx"];info taskLayoutDetails;info "-------------------------------------";statusNamevsIdMap = Map();if(taskLayoutDetails != null && taskLayoutDetails.get("status_details") != null){statusDetails = taskLayoutDetails.get("status_details");for each status in statusDetails{statusNamevsIdMap.put(status.get("name"),status.get("id"));}}info "Status NamevsId Map: " + statusNamevsIdMap;taskArrays = getAssociatedTasksResp.get("task_array");if(statusNamevsIdMap.get(statusName) != null){for each taskObj in taskArrays{taskId = taskObj.get("TID");criteriaObj = Map();criteriaObj.put("cfid","48");criteriaObj.put("criteria_condition","is");criteriaObj.put("value",{taskId});filterCriteria = Map();filterCriteria.put("criteria",{criteriaObj});filterCriteria.put("pattern","1");getTaskAssociatedIssuesParam = Map();getTaskAssociatedIssuesParam.put("index","0");getTaskAssociatedIssuesParam.put("range","25");getTaskAssociatedIssuesParam.put("sort_by","CREATED_TIME");getTaskAssociatedIssuesParam.put("is_ascending","false");getTaskAssociatedIssuesParam.put("filter",filterCriteria);getTaskAssociatedIssuesUrl = projectsDomain + "/restapi/portal/" + portalId + "/projects/" + bugProjectId + "/module/bugs/view/48/";getTaskAssociatedIssuesRes = invokeurl[url :getTaskAssociatedIssuesUrltype :GETparameters:getTaskAssociatedIssuesParamconnection:"xxxxxxxxxx"];info getTaskAssociatedIssuesRes;bugEntities = getTaskAssociatedIssuesRes.get("data").get("0").get("entities");completeTask = true;for each bug in bugEntities{if(!bug.get("is_completed")){completeTask = false;break;}}if(completeTask){updateTaskParameter = Map();updateTaskParameter.put("custom_status",statusNamevsIdMap.get(statusName));info "updateTaskParameter: " + updateTaskParameter;taskDetails = zoho.projects.update(portalId,bugProjectId,"Tasks",taskId,updateTaskParameter,"xxxxxxxxxx");info taskDetails;}}}}
Writer is a powerful online word processor, designed for collaborative work.