Most code is full of bugs. Some estimates suggest that every 20 lines of code will contain a serious bug. What can we do about it? One technique that's proven to reduce bug density is test driven development. By writing unit tests to prove that our code does what it's meant to do, we reduce the likelihood that bugs will creep in.
But how can we write unit tests for Zoho Creator apps? There's no inbuilt testing framework. We could use Selenium to write UI tests but they're slow and laborious to write and maintain.
As an alternative, I propose using HTML pages as unit testing harnesses. Here's an example of a unit test I set up to test some advanced trigonometric functions I added to my app so I could calculate distance using the great circular distance method. Deluge doesn't come with arctan/msatan out of the box, so I had to add those in. Here's an example of what I did to ensure that the functions gave the correct result.
Deluge is a powerful language that simplifies a ton of things, e.g. database lookups. But I have to say, it's very painful to debug. Interpreting longish scripts takes ages, error messages are obtuse if they exist at all and even the hints in the IDE don't always help (ever tried using containsIgnoreCase based on the auto-complete suggestion?).
Here are my tips for debugging code when it's not working.
1. Split your code up into small custom functions. Nothing's more painful than waiting 30 seconds for a really long (say 1000 lines) HTML page to save and only then get feedback on a syntax error. I've got a few apps that are like this and it's not fun to work with at all. I haven't seen any improvements in the compile speed over the last few years, so my conclusion is that it's always best to write most of your logic code as small custom functions and then build that up in the HTML page so that you'll get quick feedback on syntax errors.
In Zoho CRM, it's relatively easy to set up a one to one or one to many relationship using lookup fields. E.g. Let's say you're configuring the CRM for a real estate firm and there's a one to one mapping between owners of a house (which we'll use the Contacts module for) and the property itself (which we'll set up in a custom module). Just add a lookup in the property module for Owner and hey presto, you have a one (owner) to many (properties) relationship.
But what about if it's many to many. For example, if instead of the people being the ones selling the house, we actually want to track interested buyers. We have a few options:
1. We could rename Products to Properties and use the inbuilt many to many feature in Leads which allows you to add unlimited products to a Lead. However, if you're not using the Products module, then this won't work. There's no way to set up the same functionality for custom modules or any module apart from Products.
I've been working on chrome extensions recently and while most of the area is well documented and pretty easy to figure out, I found setting up a free trial period to be really difficult. I ended up engaging an expert to help and have documented the steps required to help other people.
1. Publish your app on the Chrome web store if you haven't already done so and set up free trial billing.
2. Setup an app in the Google dev console https://console.developers.google.com/ and obtain the client_id. Sub steps below:
a. Create the project
b. Enable "Chrome Web Store API" for this project
c. Create application using the ID from the extension in the chrome store and when they ask you to setup credentials, choose: "OAuth client ID"
3. Add this to manifest.json:
4. Add a key to the manifest. This allows you to test the extension locally in developer mode. You can get the key in the Chrome developer dashboard if you click on the "More info" for your extens…
Q: "I have a quick question. I want one of the other users to be able to send some email templates from our company address (info@...) and not from their user email. Is it possible to do it?" Yes, it is possible. When you’re logged in to your Zoho CRM, you can simply do the following:
1. Click the Emails Tab, then click on ‘Settings’ and Settings window will show up.
2. At the left hand side of the window, choose ‘Send Mail as’ under the Personalize section, then click on the ‘Add from address’ button and the Add from address window will pop up.
3. From that window, fill out the Display name and Email ID fields.
4. Choose Zoho SMTP then click on Send Verification tab.
5. Check your email for the verification code.
6. Enter your code at the ‘Confirm Verification’ window then click on the ‘Confirm’ button.
Was chatting with another Zoho dev and learnt from him that searchRecordsByPDC actually works with non-predefined columns in custom modules. It really shouldn't based on the docs (should really only allow you to access default fields added by Zoho) but somehow works anyway.
To elaborate: if you add an account lookup called LinkedAccount to a custom module, you can do this: