Attach File

Note:

  • Each time the zoho.crm.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.attachFileintegration 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. 

Description

This task is used to attach a file to the specified record in Zoho CRM.

Syntax

<variable> = zoho.crm.attachFile(<module>, <record_id>, <file_object>, <connection>);

where,

ParamsData typeDescription
<variable>KEY-VALUEspecifies the response message returned by Zoho CRM. It represents the record's creation and modification details against the API names of the respective fields and the status of the task.
<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.

Learn how to fetch the ID of a record after creating it or fetching it.

<file_object>FILEspecifies the attachment file.

<connection>

(Optional)

TEXT

specifies the name of the connection

Note: 

 

Example

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.attachFile("Leads",4770XXXXXXXXXX,file_object);

where,

response
variable which holds the response returned by Zoho CRM, which represents the creation and modification information of the record and the status of the task.
"Leads"
is the TEXT that represents the name of the module that contains the record to which the file needs to be attached
4770XXXXXXXXXX
is the NUMBER that represents the record ID
file_object
is the FILE variable that holds the attachment file

Note: 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"
     }

Related Links