Monday, April 2, 2018

Updating Zoho CRM event participants via Deluge script

Helpful tips from Ajeet from the Zoho partner team that I couldn't find documented anywhere:

Replace xxxxxx with event id
Replace yyyyy with contact id

resp = zoho.crm.getRecordById("Events", xxxxxx);
partlist = List();
partmp = map();
mp = map();
update = zoho.crm.update("Events", xxxxxxx, mp);
info update;
info partmp;

However, this will work in such a way that, let's say there is an event with existing participants, on using this code to update participants, the existing participants will be removed and new participants updated via API will be included.


Ajeet | Partner team.

Friday, March 2, 2018

Gotchas when downloading PDFs from Zoho Creator using Node JS

I spent a confusing 90 minutes trying to figure out how to download PDFs from Zoho Creator from a Node JS API. (Backstory is that I wanted to be able to email a Zoho Creator HTML page as a PDF attachment to customers).

There are two gotchas I discovered:

1. There is a 302 redirect from the URL that Zoho gives you in their documentation (e.g. to a URL like this:

You either have to use followRedirects or use the second URL.

2. Zoho Creator won't actually give you a real PDF unless you supply a realistic user agent. I spent a good hour trying to figure out why I kept getting 0 bytes back when downloading the PDF from my code. The solution was to pretend to be a browser to get the PDF.

Saturday, February 3, 2018

Creating purchase orders using deluge script

I was working on a custom function for a client to create purchase orders automatically. Everything worked fine except the product details. When you look at the JSON for a purchase order, it uses "product" for the line items. However, if you try and do the same thing when creating a purchase order, it seems to completely ignore the "product" property. Fortunately Ruben came through with a video that explains how to solve this. You have to use "Product Details" as the key instead of "product".

Here's a code snippet: