For Zoho Services only:


I'm actually part of a bigger team at Ascent Business Solutions where we have support technicians and project consultants. Support is for smaller technical fixes but this can include developments, reports or integrations; depending on the size of the task. Projects are for more time-consuming developments such as revamps of the Zoho Suite of apps or on-site training. The advantage of a team is that if I am out-of-office for a day or so, there is always someone at Ascent Business Solutions who can deal with any queries/issues you may have.

Our support rates can be found and purchased at http://ascentbusiness.co.uk/zoho-support-2. A support bundle doesn't have an expiry date. So whether we can do what you want within the bundle and a year later need further support, if there are minutes left on the bundle then there is no additional charge.

Our project rates for bigger developments can be found at http://ascentbusiness.co.uk/crm-solutions/zoho-crm-packages-prices and will involve a dedicated project consultant along with developers who will hold your hand through the development process.

If you want help building a solution for one of the Zoho Apps in the Zoho Suite, contact us on 0121 293 8140 (UK) or by email at info@ascentbusiness.co.uk. You can also visit our website at http://ascentbusiness.co.uk.

I regularly build and specialize in 2-way API integrations for Xero, Shopify and eBay.

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: The information on this website is provided without warranty and any content is merely the opinion of the author. Please try to test in development environments prior to adapting them to your production environments. The articles are written in good faith and, at the time of print, are working examples used 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 - Valid till 8 May 2022 3QnhmaBX7LQSRsC9hh6Je9rGQKEGNQNfPb
© 2021 Joel Lipman .com. All Rights Reserved.