Uploading Record Images From URLS

Zoho CRM helps businesses keep track of and manage leads, customers, products – even employees. But what about all those record images? Uploading them from URLs is not something that Zoho offers natively within the CRM, and when organizing your CRM for product inventory, or Real Estate Properties its an absolute necessity. This article will teach you how to upload your images in bulk and import them into your desired Zoho CRM module so that they are automatically associated with corresponding records created or updated by this process

How To Upload An Image To The Record Image Field

Zoho has the API documentation for image uploads listed here  and all you would need for this to work is the Oauth token. When using applications outside of Zoho, refreshing that access token would take quite a bit of extra work. Thankfully though, our solution only requires you have some sort of connection or permission to the desired photo so it may be saved in your system without issue
 

 Requirements: 
Setup a Zoho connection that allows the needed scope 

Steps: 

Settings > Connections (under developer space) > Add Connection > Zoho OAuth > 
Name the connection as you like, and enable the scope: “ZohoCRM.modules.ALL” or limit it to the one needed.

Once Completed you should see a screen like this: 

Zoho connection completion setup should show invoke url and connection name in

and now you have the ability to use CRM API features within a Zoho CRM Custom Function. 

Deluge Code To Add A Record Image From URL

Do not forget to map the arguments to get the recordid.

				
					//Getting the image you want as the record image

getimg = invokeurl
[
 url: "THE IMAGE ITSELF (NOT JUST A FOLDER LINK)"
 type: GET
];

//Setting the image url as a file

getimg.setParamName("file");
imgurl = {"http://www.zohoapis.com" + "/" + "Leads" +"/" + recordid + "/" + "photo"};

photo = invokeurl
[
url: imgurl.toText()
type: POST
files: getimg
connection: "zoauth" //This is the connection in zoho crm
];
//Debug to see the response
info photo;
				
			

This will take the image and download it directly as the record image for your module.