Associate Logs in Zoho Projects
Table of Contents
Description
The zoho.projects.associateLogs task creates a time log and associates it with the specified record in Zoho Projects.
Syntax
<response> = zoho.projects.associateLogs(<portal>, <project_id>, <module>, <record_id>, <values>, [<connection>]);
where:
Params | Data type | Description |
<response> | KEY-VALUE | The details of the time log created and the status of the executed task. |
<portal> | TEXT/ NUMBER | The name or ID of the portal. Note: You can get the name or ID of the portal using the get portals task. Click here to learn more about it. |
<project_id> | NUMBER | The ID of the project. Note: You can get project_id using the get project details task. Click here to learn more about it. |
<module> | TEXT | The name of the module in which the time log needs to be created. Allowed values:
|
<record_id> | NUMBER | The ID of the record to which the time log needs to be associated. Note: You can get the ID of the record using the get records task. Click here to learn more about it. |
<values> | KEY-VALUE | The values of the new time log that needs to be created. The keys to this parameter are provided as specified in the Zoho Projects API. The API documents for all the allowed modules are listed below: |
<connection> (optional) | TEXT | The link name of the connection. Note: This parameter is applicable to all Zoho services that has connections support, except Zoho Creator. |
Example
The following example creates a time log with the specified values and associates it with the task of ID - 548XXXXXXXXXXX885:
logs_value = Map(); logs_value.put("date", "08-12-2019"); logs_value.put("bill_status", "Billable"); logs_value.put("hours", "01:11"); response = zoho.projects.associateLogs("zylker", 548XXXXXXXXXXX771, "tasks", 548XXXXXXXXXXX885, logs_value);
where:
response
"zylker"
548XXXXXXXXXXX771
"tasks"
548XXXXXXXXXXX885
values_map
Response Format
Success Response
The success response will be returned in the following format:
{
"timelogs": {
"tasklogs": [
{
"created_time_long": 1565768280887,
"hours": 1,
"notes": "",
"owner_name": "Shawn",
"created_time_format": "08-14-2019 01:08:00 PM",
"minutes": 11,
"total_minutes": 71,
"owner_id": "58131170",
"approval_status": "Approved",
"link": {
"self": {
"url": "https://projects.zoho.com/restapi/portal/zylker/projects/548XXXXXXXXXXX771/tasks/548XXXXXXXXXXX001/logs/548XXXXXXXXXXX001/"
}
},
"last_modified_date": "08-14-2019",
"log_date_long": 1565634599000,
"bill_status": "Billable",
"last_modified_time_long": 1565768280887,
"last_modified_time_format": "08-14-2019 01:08:00 PM",
"task": {
"name": "task 1",
"id_string": "548XXXXXXXXXXX001",
"id": 548XXXXXXXXXXX001
},
"log_date": "08-12-2019",
"id_string": "548XXXXXXXXXXX001",
"id": 548XXXXXXXXXXX001,
"created_date": "08-14-2019",
"log_date_format": "08-12-2019 11:59:59 PM",
"hours_display": "01:11"
}
]
}
}
Failure Response
The failure response for invalid record ID will be returned in the following format:
{
"error": {
"code": 6404,
"message": "Resource Not Found"
}
}The failure response for invalid portal name will be returned in the following format:
{
"error": {
"code": 6504,
"message": "Domain Not Available"
}
}The failure response for invalid portal ID will be returned in the following format:
{
"error": {
"code": 6500,
"message": "General Error"
}
}The failure response for missing mandatory fields will be returned in the following format:
{
"error": {
"status_code": 400,
"instance": "/restapi/portal/zylker/projects/548XXXXXXXXXXX771/tasks/548XXXXXXXXXXX899/logs/",
"details": {
"message": "Input Parameter Missing",
"field_name": "hours"
},
"title": "INPUT_PARAMETER_MISSING",
"type": "FIELDS_VALIDATION_ERROR"
}
}The failure response for invalid date format will be returned in the following format:
{
"error": {
"code": 6832,
"message": "Input Parameter Does not Match the Pattern Specified"
}
}
}The failure response when you try to create time log for closed tasks will be returned in the following format:
{
"error": {
"code": 6403,
"message": "Time cannot be logged for closed tasks"
}
}