Attach File in Zoho CRM V8
Table of Contents
Note:
- Each time the zoho.crm.v8.attachFile integration task is executed, it triggers an API request in the back-end. This call is deducted from the external calls limit available for the service from which the task is executed, based on your pricing plan.
- Only actual executions that receive a response (whether success or failure) are counted, not the number of times the task appears in the script. For example, if zoho.crm.v8.attachFile integration task is placed inside a for each task that iterates five times, the number of external calls consumed will be five, even though the task appears only once in the script.
Overview
This task is used to attach a file to a Zoho CRM record based on the specified module name and record ID.
Syntax
<variable>=zoho.crm.v8.attachFile(<module>,<record_id>, <file_object>, <connection>);
where,
| Parameter | Data type | Description |
| <variable> | KEY-VALUE | Holds the response returned by Zoho CRM on successful task execution or error details on task failure. |
| <module> | TEXT | Specifies the API name of the module that contains the record to which the file needs to be attached. Applicable modules can be found on this page. |
| <record_id> | NUMBER | Specifies the ID of the record to which the file needs to be attached. |
| <file_object> | FILE | Specifies the file that needs to be attached. |
| <connection> | TEXT | Represents the link name of the connection which is connected to your Zoho CRM account. Note:
|
Note:
In integration tasks, the parameters must be in the defined order as given in the syntax, for the Deluge task to be executed. If you choose to use an optional parameter, ensure that all preceding parameters in the syntax are explicitly specified. If a preceding optional parameter is not required, a null value can be assigned instead, to maintain the defined syntax order.
For example, in the below syntax, options_map and connection are optional parameters:
<variable> = zoho.crm.v8.task (<module_name>, <record_details>, <options_map>, <connection>);
If you want to use the connection parameter, module_name, record_details and options_map must be specified in the
exact order as the syntax. You can assign an empty map to the options_map parameter if it is not required.
Example : Attach a file to a record in Leads module
The following script attaches the file - file_object, to the record with ID - 4770XXXXXXXXXX in the Zoho CRM module - Leads.
file_object=invokeUrl[url:"https://assets.pcmag.com/media/images/431075-zoho-logo.jpg?width=810&height=456"type:GET];response=zoho.crm.v8.attachFile("Leads",4770XXXXXXXXXX,file_object);
where,
response"Leads"4770XXXXXXXXXXfile_objectNote: The invokeUrl task fetches the file from cloud storage.
Response Format
Success Response
The success response returned is of the following format
{
"code":"SUCCESS",
"details":{
"Modified_Time":"2018-12-11T12:20:45+05:30",
"Modified_By":{"name":"John","id":"4770XXXXXXXXXXXXXXX"},
"Created_Time":"2018-12-11T12:20:45+05:30",
"id":"4770XXXXXXXXXXXXXXX",
"Created_By":{"name":"John","id":"4770XXXXXXXXXXXXXXX"}
},
"message":"attachment uploaded successfully",
"status":"success"
}
Failure Response
The failure response returned for incorrect or non-existent record ID is of the following format
{
"code":"INVALID_DATA",
"details":{},
"message":"the related id given seems to be invalid",
"status":"error"
}