For Zoho Services only:


I'm actually part of something bigger at Ascent Business Solutions recognized as the top Zoho Premium Solutions Partner in the United Kingdom.

Ascent Business Solutions offer support for smaller technical fixes and projects for larger developments, such as migrating to a ZohoCRM.  A team rather than a one-man-band is always available to ensure seamless progress and address any concerns. You'll find our competitive support rates with flexible, no-expiration bundles at http://ascentbusiness.co.uk/zoho-support-2.  For larger projects, check our bespoke pricing structure and receive dedicated support from our hands-on project consultants and developers at http://ascentbusiness.co.uk/crm-solutions/zoho-crm-packages-prices.

The team I manage specializes in coding API integrations between Zoho and third-party finance/commerce suites such as Xero, Shopify, WooCommerce, and eBay; to name but a few.  Our passion lies in creating innovative solutions where others have fallen short as well as working with new businesses, new sectors, and new ideas.  Our success is measured by the growth and ROI we deliver for clients, such as transforming a garden shed hobby into a 250k monthly turnover operation or generating a +60% return in just three days after launch through online payments and a streamlined e-commerce solution, replacing a paper-based system.

If you're looking for a partner who can help you drive growth and success, we'd love to work with you.  You can reach out to us on 0121 392 8140 (UK) or info@ascentbusiness.co.uk.  You can also visit our website at http://ascentbusiness.co.uk.

Zoho CRM: Upload a Product Photo using Deluge

What?
A quick article to remind me on how to upload a photo using CRM API v2. Yes it's documented and yes it still confuses me now and again. So I'm writing this to remind me and to keep reminding me of how to do this.

Why?
My use-case is that I have a photo in Zoho Creator but the source doesn't really matter as the part I struggled on was uploading it to CRM. I want to update the photo in the CRM record.

How?
So we have to do the usual which is download the photo using invokeUrl then we set the paramname not to attachment but to file. We then use another invokeUrl to upload the photo to CRM:
copyraw
// init
v_AppOwner = "joel_the_awesomest";
v_AppName = "joels_app";
v_ReportName = "My_Report";
// specify your CRM record ID for this product
v_CrmProductID = 1234567890123456789;
// specify your Creator record ID holding the image
v_CreatorQuoteID = 9876543210987654321;
//
// get the full details of the Creator record
r_GetFullRecord = zoho.creator.getRecordById(v_AppOwner,v_AppName,v_ReportName,v_CreatorQuoteID,"joels_creator");
if(!isnull(r_GetFullRecord.get("data")))
{
	r_CreatorRecord = r_GetFullRecord.get("data");
	v_CreatorPhotoUrl = ifnull(r_CreatorRecord.get("Display_Photo"),"");
	if(v_CreatorPhotoUrl!="")
	{
		//
		// download photo from your Creator (change connection and check TLD)
		v_Endpoint1 = "https://creatorapp.zoho.com" + v_CreatorPhotoUrl;
		r_CreatorPhoto = invokeUrl
		[
			url: v_Endpoint1
			type: GET
			connection: "joels_creator"
		];
		info r_CreatorPhoto;
		//
		// set the param name to file (this is important)
		r_CreatorPhoto.setParamName("file");
		//
		// upload the photo to CRM (and prevent workflows from running)
		v_Endpoint2 = "https://www.zohoapis.com/crm/v2/Products/" + v_CrmProductID + "/photo?restrict_triggers=workflow";
		r_CrmPhoto = invokeurl
		[
			url: v_Endpoint2
			type: POST
			files: r_CreatorPhoto
			connection: "joels_crm"
		];
		info r_CrmPhoto;
	}
}
  1.  // init 
  2.  v_AppOwner = "joel_the_awesomest"
  3.  v_AppName = "joels_app"
  4.  v_ReportName = "My_Report"
  5.  // specify your CRM record ID for this product 
  6.  v_CrmProductID = 1234567890123456789
  7.  // specify your Creator record ID holding the image 
  8.  v_CreatorQuoteID = 9876543210987654321
  9.  // 
  10.  // get the full details of the Creator record 
  11.  r_GetFullRecord = zoho.creator.getRecordById(v_AppOwner,v_AppName,v_ReportName,v_CreatorQuoteID,"joels_creator")
  12.  if(!isnull(r_GetFullRecord.get("data"))) 
  13.  { 
  14.      r_CreatorRecord = r_GetFullRecord.get("data")
  15.      v_CreatorPhotoUrl = ifnull(r_CreatorRecord.get("Display_Photo"),"")
  16.      if(v_CreatorPhotoUrl!="") 
  17.      { 
  18.          // 
  19.          // download photo from your Creator (change connection and check TLD) 
  20.          v_Endpoint1 = "https://creatorapp.zoho.com" + v_CreatorPhotoUrl; 
  21.          r_CreatorPhoto = invokeUrl 
  22.          [ 
  23.              url: v_Endpoint1 
  24.              type: GET 
  25.              connection: "joels_creator" 
  26.          ]
  27.          info r_CreatorPhoto; 
  28.          // 
  29.          // set the param name to file (this is important) 
  30.          r_CreatorPhoto.setParamName("file")
  31.          // 
  32.          // upload the photo to CRM (and prevent workflows from running) 
  33.          v_Endpoint2 = "https://www.zohoapis.com/crm/v2/Products/" + v_CrmProductID + "/photo?restrict_triggers=workflow"
  34.          r_CrmPhoto = invokeUrl 
  35.          [ 
  36.              url: v_Endpoint2 
  37.              type: POST 
  38.              files: r_CreatorPhoto 
  39.              connection: "joels_crm" 
  40.          ]
  41.          info r_CrmPhoto; 
  42.      } 
  43.  } 

The above should yield something like:
copyraw
/1234567890123_my_beautiful_face.jpg

{"code":"SUCCESS","details":{},"message":"photo uploaded successfully","status":"success"}
  1.  /1234567890123_my_beautiful_face.jpg 
  2.   
  3.  {"code":"SUCCESS","details":{},"message":"photo uploaded successfully","status":"success"} 

Source(s):
Category: Zoho :: Article: 774

Credit where Credit is Due:


Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman
www.joellipman.com

Related Articles

Joes Revolver Map

Accreditation

Badge - Certified Zoho Creator Associate
Badge - Certified Zoho Creator Associate

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Paypal:
Donate to Joel Lipman via PayPal

Bitcoin:
Donate to Joel Lipman with Bitcoin bc1qf6elrdxc968h0k673l2djc9wrpazhqtxw8qqp4

Ethereum:
Donate to Joel Lipman with Ethereum 0xb038962F3809b425D661EF5D22294Cf45E02FebF
© 2024 Joel Lipman .com. All Rights Reserved.